0
votes

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?).

1
I believe that you are correct, and that _root.loadMovie() is working as an equivalent to loadMovieNum(). I'm afraid that if you do not want to load your player swf into the root then you might have to consider either porting your application to AS3 or rewriting your video player using YouTube's AS2 api: developers.google.com/youtube/flash_api_reference_as2 - shanethehat
Thanks for the answer, unfortunately the youtube as2 api will continue to operate until October 14, i guess after that date it wouldn't work. I think i will try to convince the boss to forget AS2 and invest in porting everything to AS3. - Alex

1 Answers

0
votes

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.