Skip to main content
Participant
September 28, 2011
Question

AIR for iOS, Embedded SWF MovieClip

  • September 28, 2011
  • 2 replies
  • 2132 views

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 has been closed for replies.

2 replies

Inspiring
September 28, 2011

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.

Known Participant
September 28, 2011

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

Inspiring
September 28, 2011

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.

Colin Holgate
Inspiring
September 28, 2011

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