Skip to main content
Participant
Sep 28, 2011 6:07 AM UTC
Question

AIR for iOS, Embedded SWF MovieClip

I would like to play a movie clip that I have a in a separate SWF file.  The following code works on my PC debugger, but the movie does not play (or even load) on iPhone.  Is this possible on iOS?  What am I doing wrong? Thanks in advance...

  [Embed(source = '../assets/cinematics/test.swf', mimeType='application/octet-stream')] static public const CINEMATIC_A_SWF:Class;

    loader = new Loader();

    var context:LoaderContext = new LoaderContext();

    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, movieLoadComplete);

    loader.loadBytes(new CINEMATIC_C_SWF() , context);

private function movieLoadComplete(evt:Event):void

  {

   movieClip = (loader.content as MovieClip);

   movieClip.play();

  }

This topic is closed to new replies. Start a new post to keep the conversation going.

4 replies

Inspiring
Sep 28, 2011 8:26 AM UTC

You cannot play compiled swf inside an iOs app. The linker cannot execute AS3 code inside an objective-C engine.

The trick you can do is to export your movieclip in a swc in Flash.

Add the swc in your project, and create an instance of it. Your can play after with it without problem.

Translate
Known Participant
Sep 28, 2011 10:28 AM UTC

Vincent35, can you elaborate a little on this please?

Can this trick somehow be used to take 5 swf files (each of 1 game) and then make 1 swf with a menu which can start somehow 1 of those 5 games? (on iOS of course)

Can a complete swf be put in a swc and then loaded in from a menu-app made in as3 on ios ?

Kind regards,

Bart

Translate
Inspiring
Sep 28, 2011 1:11 PM UTC

Bart,

In flash CS, when you have a movieclip, you can link it in the library with a as3 class, for example, dog class.

After that, if each game you have is in a movieclip, you can link it with a class named game1 for example

And in your top-application, you create one object with the class game1 and add it to the display list.

Translate
Colin Holgate
Inspiring
Sep 28, 2011 8:26 AM UTC

Your code doesn't include an addChild(), so it could be that it's loaded and playing, you just can't see it.

Translate