Alex
Alex

Reputation: 127

Load as3 into as2 work only on _root

i made a simple test example in as2. This contains two buttons with the following handlers.

_root:

on (release)
{
    this.loadMovie("AS3.swf");      
}

_root.test.testmc:

on (release)
{
    test.testmc.loadMovie("AS3.swf");       
}

The AS3.swf is a video player(using youtube as3 api). If i load it into _root it works, but if i want to load it into any other place it doesn't. I searched and found this from adobe:

"SWF files written in ActionScript 1.0 or 2.0 cannot load SWF files written in ActionScript 3.0. This means that SWF files authored in Flash 8 or Flex Builder 1.5 or earlier versions cannot load ActionScript 3.0 SWF files.

The only exception to this rule is that an ActionScript 2.0 SWF file can replace itself with an ActionScript 3.0 SWF file, as long as the ActionScript 2.0 SWF file hasn't previously loaded anything into any of its levels. An ActionScript 2.0 SWF file can do this through a call to loadMovieNum(), passing a value of 0 to the level parameter."

Is the "_root part" of my code working because of the above "exception rule"? I am new to flash(yeah you could ask why i started with as2, unfortunately not my choice...) and i wonder if my thinking is right. Also if there is any sort of workaround(other than rewrite everything in AS3), let me know(maybe use of localconnection?).

Upvotes: 0

Views: 2381

Answers (1)

Ace
Ace

Reputation: 1477

Try this:

on root of as2:

test.testmc.loadMovie("AS3.swf");

or in the mc u want the as3 player:

this.loadMovie("AS3.swf");

Your second code is calling test.testmc.test.testmc because it is already placed in the "testmc" so you dont need to reference it with the full path. It's recommended that you use relative paths for things like this.

So, inside the mc testmc you just need to do this.loadmovie instead of searching for test.testmc INSIDE testmc.

Hope that was what you're looking for.

Upvotes: 0

Related Questions