external swf load into main swf - actionscript

I need to load exteranal swf into my main swf into a dispay object in this main swf. how do it? i like to play gta!

Check out the loadMovie function for ActionScript 1 or 2.
Or if you are using ActionScript 3 then use the loader function

You can also check the greensock classes:
http://www.greensock.com/
They've got some great tools for loading swfs or generally loading assets , very useful if the loaded swf is loading other assets and you want to keep track of the overall loading progress.

Related

Flash / Animate: Multiple SWF on iOS?

I am working on an app for my work, where I need to bring in several (around 8 to 9) SWFs into an flash file that is being published to an iPhone. I have the flash projects each of these SWFs were created in, but they did not use the timeline at all, instead each are completely made through code.
I was able to load in the SWFs and get them running on the phone, but only through interpretor mode in Flash. The issue with this is it is not reliable and causes massive slow down after extended use.
I know that the other modes support a single secondary SWF with actionscript.
Here is the code I am using to load in each one.
myLoader = new Loader(); // create a new instance of the Loader class
var url:URLRequest = new URLRequest("JavierNew/app.swf"); // in this case both SWFs are in the same folder
myLoader.load(url); // load the SWF file
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, demoLoaded);
Does anyone have any solutions or suggestions for how I can better import these in a better fashion? To my knowledge there is no way to import the swf or the whole project file into the main .Fla, or a way to combine all the .swfs together.
Any help would be appreciated! Thank you so much!

How to support Flash images and flash video's in ios programatically

For ex : I am loading an url which contains an flash image ,which is not loading in ios .
Another one is i am loading a video of .flv format , how to support this in ios ?
The web view does not support .swf files, but there are libraries that will render .swf files for iOS:
SwiffCore
SwiffCore wasn't even the one I was thinking of. There's some C library also. The popular game Clash of Clans renders .swf assets in the game.

External swf plays very slow on iOS

I'm writing an application using as3 and adobe air that loads external SWF files and plays them internally in the application. The container works just fine with android and the animation of the external swf file is very cool.
However, on the iOS (iPad 2), it runs very slow as if its playing only 1 frame per second.
Is there anyway at all to make it play faster.
My application configuration is as follow:
<initialWindow>
<autoOrients>false</autoOrients>
<aspectRatio>landscape</aspectRatio>
<renderMode>gpu</renderMode>
<fullScreen>false</fullScreen>
<visible>true</visible>
<softKeyboardBehavior>none</softKeyboardBehavior>
</initialWindow>
This is the part of code where I load the external swf:
public function set url(value:String):void
{
_url = value;
object.source = File.applicationDirectory.resolvePath(value).url;
object.addEventListener(Event.COMPLETE , onLoaded);
}
protected function onLoaded(event:Event):void
{
object.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
protected function onEnterFrame(event:Event):void
{
if((object.content as Object).currentFrameLabel == "stop")
(object.content as Object).stop();
}
I also tried to comment the Enter frame event listener but nothing changed.
Thanks in advance.
Edit:
I figured out something that is very strange actually. When I run the application from the application with the Fast configuration, it runs fast. But when I publish it or use the Standard option while running it runs really slow.
Tested with AIR 3.2
try setting your render mode to direct:
<renderMode>direct</renderMode>
Remember, when you are rendering exclusively to the GPU, it will slow things down if you are rendering animations. Although rendering to the GPU is fast, allocating Video Memory to the GPU is slow. If you render exclusivity to the GPU, on every frame, the video memory will need to be updated.
Another thing is that all vectors will be rasterized so some things will render pixelated.
A couple of things:
You aren't allowed to load SWFs that have any code in them, in AIR for iOS. This is forbidden by Apple.
You should only use swf at most as a library of graphics / resources when compiling for iOS. If a movieclip inside has stop(); on one of the frames, then this counts as an 'addFrameScript()' under the hood, which means that SWF contains ActionScript.
I suggest if you need functionality as such, create a list of predefined behaviours to be compiled into your main app, then run these behaviours based on the type or name of asset you are instantiating from your SWF library, attaching them at runtime.
Besides, if you are doing this to allow updates -- or the ability to modify the app, post-release, then you may as well compile it into the release build, and just republish next time you want an update to the app. This will help your ranking in the app store to some extent, and remove a lot of versioning issues down the line.

SWF file extraction

If I have a link to a SWF file - for example here http://redletterdaysb2b.co.uk/swf/our-video.swf
how can I extract it for use on another website?
I have downloaded the swf, but just get an error#2044 when I try and play it. does it need to go in some sort of wrapper?
thanks guys
You're trying to load a swf that in turn loads and displays a .flv using the FLVPlayback component. I'm guessing our-video.swf loads fine, but it probably keeps a relative reference to the .flv.
I can think of two ways to handle this:
Simple add a new FLVPlayback (or any other video player) on the other site but tell it to load the .flv file from the original site.
Try to copy the .flv file in the same folder as the new .swf on the new site.
With the FLVPlayback component there's another part that could cause the error: the skin which on the original site is here.
The #2024 IOError should also include an URL.
This is your best hint to how the our-video.swf is trying to load the .swf file (using a relative(./swf/redletterdays.swf) or an absolute(/swf/redletterdays.swf) path).
Based on this, if you decide to load the player from the original site (not just the .flv file), you can work out where to place the skin (i.e. in the in a folder named swf on the root of the new site)

How to load only a part of file by useing FileReference.load in Flash

Is there any way to load only a part of a big file by useing FileReference.load() in flash player?
It's known that the AS3 API FileReference has given the ability to load local file in flash.
However, in the case which you want pre-process this file in flash, the only way is by using the FileReference.load function. Unfortunately, the FileReference.load function will load the total file in the memory immediately. And the size of the loading file is limited up to 100M.
So, what i want to do is just load a part of the file whoes size is under 100M, process it, and upload it, and then load another one.
Any one has any idea?
Thanks :)

Resources