AS3 swf loaded as AVM1Movie

I have an as3 proj in flex.
I have a custom class Screen which is complied into a swf (by
flex)
I'm loading this file via a Loader..., then passing data up
to it on INIT.
fine that works great for the first time, second time, then
on the third time nothing.
when I trace for the type of the Loader.content, the first
two times it traces [Screen,Object] as expected but on the third
time it traces [AVM1Movie, Object].
what's this about?? is it some security thing??
the relevent code is below - the path resolves in all cases
to the same path (..../SimpleScreen.swf)
// ActionScript file
package gs.ctl
// imports
import flash.display.DisplayObjectContainer;
import flash.display.Loader;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.net.URLRequest;
import flash.system.ApplicationDomain;
import flash.system.LoaderContext;
import gs.mdl.LoadXmlUnicode;
import gs.vw.Screen;
import mx.utils.StringUtil;
import utils.LogEvent;
public class Navigator extends EventDispatcher implements
INavigator{
private var _currentScreenLoader:Loader
private var _currentScreen:Screen
private var _currentScreenXml:XML
private var _screenSetXml:XML
private var _rootScreen:DisplayObjectContainer
private var _pathUserRoot:String
private var _pathData:String
private var _pathAssets:String
private var _URLscreenSet:String
private var _legalScreenItems:XMLList
private function _changeScreen():void{
var URLReq:URLRequest = new
URLRequest(_pathUserRoot+"\\"+_pathAssets+"\\"+_currentScreenXml.url);
var context:LoaderContext = new LoaderContext();
context.applicationDomain = ApplicationDomain.currentDomain;
_currentScreenLoader=new Loader();
_currentScreenLoader.contentLoaderInfo.addEventListener
(Event.INIT, _initHandler)
_currentScreenLoader.load(URLReq, context);
private function _initHandler(event:Event):void{
if(_rootScreen.numChildren==2)_rootScreen.removeChildAt(0)
trace("type = "+_currentScreenLoader.content)
_currentScreen=Screen(_currentScreenLoader.content);
_rootScreen.addChild(_currentScreen)
_currentScreen.setData(screenXml, _legalScreenItems,
_pathUserRoot+"\\"+_pathAssets+"\\");
_currentScreenLoader.unload();

-- When u say first time, seccond.... you mean each time you
compile your flex applicaction?
I mean every time the changeScreen function is called... ie
at run time.
strange eh??
this is no longer an urgent issue, as i've change the
architecture now (much better :~) but I would like to know whats
happening

Similar Messages

  • External as3 swf loaded as amv1movie in flash player 10.1.53.64.2

    Greetings!
    I've got a problem with new flash player 10.1.53.64.2 (activex component) on windows 7 and windows XP (vista was not tested) no matter x86 or x64. This problem doesn't not appear on previous versions of player such as 10.0.42.34 and lower 9.0.45. The problem is: when I load external movie it loads as amv1movie thought both swf's are in ActionScript3.
    Proof
    flash player 10.1.53.64.2:
    loadGraphics(checkbox.swf)
    loadGraphics.onOpenCompleteLoaded: [Event type="open" bubbles=false cancelable=false eventPhase=2]
    loadGraphics.onInitCompleteLoaded: [Event type="init" bubbles=false cancelable=false eventPhase=2]
    loadGraphics.onUrlCompleteLoaded
    afterGraphicsLoaded checkbox
    afterGraphicsLoaded. height and width
    afterGraphicsLoaded. added templateObject to stage [object AVM1Movie]
    flash player 10.0.42.34:
    loadGraphics(checkbox.swf)
    loadGraphics.onOpenCompleteLoaded: [Event type="open" bubbles=false  cancelable=false eventPhase=2]
    loadGraphics.onInitCompleteLoaded: [Event type="init" bubbles=false  cancelable=false eventPhase=2]
    loadGraphics.onUrlCompleteLoaded
    afterGraphicsLoaded checkbox
    afterGraphicsLoaded. height and width
    afterGraphicsLoaded. added templateObject to stage [object mySuperCheckBox]
    Please help!

    You may be better off asking in the Flash or ActionScript forum.

  • AS2 SWF loaded inside a AS3 SWF

    Hi,
    In a recent project I had to load a FlashPaper2 document
    inside a SWF implemented in AS3. I read a couple of articles about
    Darron
    Shcall's article and
    FlashInterface
    but none of them seemed to be useful in my case.
    I needed to load a FlashPaper SWF inside a AS3 and couldn't
    rely on ExternalInterface since they were not two separate SWF's.
    To be more clear, I was using the Loader class via a Sprite to load
    the FlashPaper SWF.
    Anyways, I created FlashPaperLoader.SWF implemented in AS2
    which was used to load the FlashPaper SWF. This loader was able to
    communicate with the FlashPaper APIs (AS2). As you can guess, the
    AS3 SWF was used to load the FlashPaperLoader.swf.
    What I don't understand is how come the FlashPaperLoader the
    FlashPaper document SWFs can communicate with each other thru AS2
    function calls when they are loaded inside a AS3 SWF, I thought
    that due to VM differences, no communication is possible!
    I hope I was clear, if I was, any guru insight is really
    appreciated.
    Cheers.

    Thanks kglad,
    But you still haven't answered my question. I am not looking
    for solutions, my own solution works. I wanted to understand more
    about the VM's.
    AS3
    var request:URLRequest = new
    URLRequest("./FlashPaperLoader.swf");
    var loader:Loader = new Loader();
    loader.load(request);
    AS2
    var loader:MovieClipLoader = new MovieClipLoader();
    loader.loadClip("./FlashPaperDoc.swf", fpContainer);
    // the loader SWF used IFlashPaper APIs to communicate with
    the FlashPaper SWF.
    Now, the first part (AS3), all that code is interpreted by
    VM2. Once an AS2 SWF is loaded a
    AVM1Movie
    is created and no direct communication between AS3 and AS2 is
    possible. I am curious to know how come the two AS2 SWFs can
    communicate with each other while inside the VM2 space.

  • Loading external SWF's into an SWF Loader as3 style?

    Hi,
    I've recently made the switch from as2 to as3 and am still struggling to get my head around one aspect in particular. I've managed to load one external swf into a blank file via the script
    import LoadDisplayObject;
    var loader:LoadDisplayObject = new LoadDisplayObject("button_01.swf", true);
    loader.addEventListener("displayObjectLoaded", onComplete, false, 0, true);
    addChild(loader);
    function onComplete(evt:Event):void {
         trace("loaded complete received");
         loader.scaleX = loader.scaleY = .75;
    .....however I'm struggling with the script to make a swfs load into a space when one of my 3 buttons is clicked....
    My page currently has three buttons (button_01, button_02 and button_03) and in a local folder three separate swfs with the same names which I wish to load in, when the appropriate button is pressed. 
    I have managed to get them to load in using a tutorial...however they load over the top of each over...far from ideal. From research on the internet I've found a range of different script...but I just can’t find anywhere I can find script to make this work..hence why I have turned to here.
    Any help much appreciated...thanks in advance.

    Hi,
    Just throught I would let you know that I've manged to get this to work this morning. Changed the script slightly and used a different method of:
    var home:MovieClip = this;
    function butt1Click(evt:MouseEvent):void {
        var ldr:Loader = new Loader();
        ldr.load(new URLRequest("button_01.swf"));
        ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
    function butt2Click(evt:MouseEvent):void {
        var ldr:Loader = new Loader();
        ldr.load(new URLRequest("button_02.swf"));
        ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
    function butt3Click(evt:MouseEvent):void {
        var ldr:Loader = new Loader();
        ldr.load(new URLRequest("button_03.swf"));
        ldr.contentLoaderInfo.addEventListener(Event.INIT, loaded);
    function loaded(evt: Event):void {
        if(contentClip.numChildren > 0){
            contentClip.removeChildAt(0);
        contentClip.addChild(evt.target.content);
    button_01.addEventListener(MouseEvent.MOUSE_UP, butt1Click);
    button_02.addEventListener(MouseEvent.MOUSE_UP, butt2Click);
    button_03.addEventListener(MouseEvent.MOUSE_UP, butt3Click);
    seems to work well. Only small question is if I want one page to load automatically upon opening...how do I alter the script to do this??? Thanks

  • Load AS2 swf into AS3 swf problem

    I have a flash with AS3 and inside this swf i load in a AS2 swf.
    to load swf works just fine, but the problem is when i load this i want to go to
    a specific part of it, for example i want to go to frame 3 in the loaded swf.
    i must control this from the AS3 swf, does someone know if this is possible?
    thanks in advance

    so can i do like this then to go to frame 3 in my loaded swf?
    MovieClip(ldr.content).gotoAndStop(3); ?
    sorry for being such an airhead
    thanks for helping me out =)
    Date: Sun, 7 Jun 2009 10:25:09 -0600
    From: [email protected]
    To: [email protected]
    Subject: load AS2 swf into AS3 swf problem
    no.
    if, in your loaded swf, you have a function f1() on the loaded swf's main timeline and you load that swf using a loader (say ldr), use:
    MovieClip(ldr.content).f1();   // to call f1() in the loaded swf
    >

  • Load AS2 SWF in AS3 SWF with FlashVars

    I am able to load SWF which is created using AS2 in to AS3
    SWF but I am not able to pass Flashvars to it..
    Does any one has any idea, how can I do that??
    Thanks

    You can talk to loaded AVM1 (AS1/2) SWF using LocalConnection. I used Grant Skinner's SWFBridge class in the past and worked very well:
    http://gskinner.com/blog/archives/2007/07/swfbridge_easie.html
    Kenneth Kawamoto
    http://www.materiaprima.co.uk/

  • Can I load AS3 swf in AS2 file

    I have downloaded a xmlphotoalbum (www.xmlphotoalbum.com) which is in AS3 and uses lots of external classes and functions,
    I am trying to load it withing a AS2 movie but it's not running and it is not giving me any errors.
    how can I make this run?
    would you please download the xmlphotoalbum and try it?
    I am not using an AS3 file to load the xmlphotoalbum because I don't know how to handel AS3 and load external swf files and play then and then unload them.
    I have tried using the get ulr and addchild() fucntions. but since I am not experienced it AS3 it's bit confusing for me and also I dont know how to control the playback of the loaded swf files.
    I am doing all this for a CD presentation, not a a web site.

    Hi there
    You are probably wanting help with Flash.
    Although this forum says "FlashHelp", what it is for is an output type from a product called RoboHelp.
    Click here to visit the Flash community
    Cheers... Rick
    Begin learning RoboHelp HTML 7 within the day - $24.95!
    Click here for Adobe Certified Captivate and RoboHelp HTML Training
    Click here for the SorcerStone Blog
    Click here for RoboHelp and Captivate eBooks

  • Convert AS2 swf to AS3 swf

    I have a swf (written in AS3) that loads other swfs into it.
    There are no issues when loading other AS3 swfs but there is a
    problem loading AS2 swfs. I get the following error:
    TypeError: Error #1034: Type Coercion failed: cannot convert
    flash.display::AVM1Movie@35d3a51 to flash.display.MovieClip.
    Is there any way to convert the AS2 swf into a AS3 swf so it
    will be compatible with my loader? I cannot go back and change the
    AS2 swfs because I do not have the fla files. Or is there any way
    to incorporate AS3 code that will load AS2 swfs properly? It seems
    hard to believe that Adobe would neglect this backwards
    compatibility issue. Thanks

    Hello Andrei1,
    Thanks for looking at my simple AS3 code. The AS2 swfs that
    I've been working (and having difficulties) with are components
    that I've purchased from places like www.flashden.com. Some are
    image transitions (such as "Dynamic Image Draw found at
    http://www.flashden.net/item/dynamic-image-draw/7532)
    while another is used to create a looped banner rotator animation
    (IMG_loop, a free d/l from www.afcomponents.net). I have another
    that uses an .xml file to configure a slideshow animation.
    You mention "needing to do more" if AS2 scripts inside its
    swf are to be run by the parent AS3 fla; what would these lines of
    code be?
    In researching my problem further I've since realized that
    most of these issues deal both with the version of AS used, as well
    as the version of the Flash player the fla is set up to animate
    for. In particular, the "Dynamic Image Draw" component requires
    that Flash Player 8 or 9 be used with AS2.
    Given that many of my purchased components are like this,
    I've since changed my main fla movie from AS3 back to AS2 and have
    learned that the scripting needed to call individual multiple swfs
    into it at various points in the timeline is MUCH simpler!!!!! One
    single, easily interpreted, line of code vs. 5 lines using
    variables and much more arcane (to me) function calls.
    I started my file with AS3 figuring that I'd be better off
    learning the new version of the language; much stress and
    forehead-rubbing later, I've seen just how much easier and
    understandable AS2 is to learn.
    I recognize that there are likely very strong arguments for
    the more structured coding approach used by AS3, but for someone
    like me who wants to generate customized Flash presentations with
    little fuss, I'm not qualified to make them.
    Perhaps this is a no brainer for those many flash gurus out
    there, but for me this tiny bit of wisdom has been hard fought for!
    That being said, is there an easy way to convert a swf file
    created using AS2 to something that AS3 can work/interact with?
    I've come across a free d/l product called actionscript bridge, but
    haven't been able to understand how to get it to work.

  • Problems with a AS3 SWF

    Hello,
    I am having issues with a SWF file posting properly in a Catalyst project.  I have already put a post in the Catalyst section but I wanted to bounce the idea off this room that the issue is more SWF and less Catalyst because everything else in Catalyst is working just fine, including other AS3 SWF files that I have linked throught the site.  The files are here:
    www.electronic-lifestyle.com
    If you enter the Home Theater section you will see a SWF load in the film frame after it downloads (maybe 3 seconds).  This SWF with alter the screen on the image and give you controls on the bottom right corner to shift the aspect ratio of the content on the projection screen.  This is a AS3 SWF that works just fine, but if you click on Electronics the page shifts to another film frame that is blank.  It is a scroll panel in Catalyst that is refusing to load the content which is a SWF with several links set up as buttons in AS3.
    I cannot figure out why one SWF will work and the others will not.  Is it possible that I am publishing the files incorrectly somehow?  I checked the publish settings for the files that work and the files that don't and they are exactly the same.  I have tried to rebuild the pages with both the good SWFs and the bad SWFs and I get the same results.
    Even more puzzling is that the entire project works when I check the Local files.  The issue only rears it's ugle head when I put it on the server and try it live.
    If anyone has insight into the connectiuon between Flash AS3 SWFs and the way FXP files imports them that could come close to explaining this please let me know.  The only difference between the two are the buttons, I am going to try to remove the buttons and see if the SWF works.
    Thanks in advance,
    Brett

    Hey,
    Yes I have figured out the issue and I simply can't believe the solution.  I have been discussing it on the Flash Catalyst Forum.  Here is a recent post, please feel free to take a look at the page I have set up to demonstrate the issue in case you ever come across it.  It is a real kick in the head.
    Brett
    Chris,
    Thanks for  the tip but I just figured out the problem and you are not going believe  this.  I removed the buttons from two of the scroll panes and replaced  them with buttons made in Catalyst and the problem magically went away.   Take a look at this page:
    www.electronic-lifestyle.com/SpeakSEL-OLD/Main.html
    The first three pages work just fine but the Third and Fourth pages (Outdoor & Subwoofer) will not load the SWF.   The ONLY difference between these two pages are the buttons in Flash.   It would seem that buttons will create a destructive error that prevents  the SWF from loading.
    If this pans out then the  developers for Adobe really missed a big one with this.  I have over 47  pages that now need to be rebuilt because I assumed that a button built  in AS3 would not interfere with the SWF load.
    Now this  isn't something that happens all the time, I have several SWFs in this  site that use buttons and work just fine but they are nested in Movie  Clips and they all have to do with timeline controls rather than opening  another URL.  Maybe the "_blank" tag is the issue but I am required to  get the user to a different page by the client's request.  I can't very  well go back to the client and tell him that Catalyst has an issue with  that very normal request.
    Anyway, thanks for the  suggestion, I am spending the rest of my day republishing my SWFs  without buttons just to remake them in FC.  BTW, the real kick in the  head is that the SWFs with the buttons work on the local files, its when  you upload to a server that everyting seems to fall apart.
    Brett

  • Flex to AS3 swf

    I want to get swf files I have produced in Flash Builder 4.5 into Prezi.
    They require what they are calling an "AS3 SWF" file for loading.
    My SWF from FB is not making the trip.
    Any ideas as to how I can get my FB swf to be/look like an AS3 swf?
    Thanks.

    Flex has several dependencies on the framework itself. If you want to bring it into Prezi, I'd create it in Flash and keep it pure actionscript.

  • Communication between AS2 Template and AS3 Swf

    I created a template in AS2 which loads as2 swf's. i want to load as3 swf. then how can load as3 swf.within as2 template.
    please help me to find out this...

    hI,
    Look at package SDYNAMICDOCUMENTS, or look for DD_* ( This is Dynamic Documents  Tamplates ) in SE38.
    Regards,
    Marcelo Ramos.

  • AS3 SWF inside Director 11.5.9 quirk

    I've previously used AS2 SWFs inside Director 11.5.9, and the SWFs work fine, actionscript works as it should.
    I'm working on a project where I need to use some AS3 SWFs inside Director, and I've come across a limit on the pixel width and height of the SWF. It seems that if either the pixel width or height of the published SWF are greater than 1638, then any actionscript inside the SWF is ignored when the SWF is loaded into director. The SWF still works ok outside of Director.
    For example, any actionscript stop(); commands are ignored and the playback continuously loops through the swf timeline.
    Has anyone come across this before?
    I am almost 100% certain this issue is related to the pixel width / height, as I've made a simple button navigation swf, and published it with different stage sizes. 1638 or less work inside Director, 1639 or more don't work inside Director!

    Made me laugh until I cried...
    Or did I just cry? :(
    Cruel but funny!
    Richard

  • AS3 swf tiny question

    I have a feeling that I know the answer to this. I am not
    terribly savvy on Actionscript (basic sklls, not expert)..and not
    in 3.0 at all!!!!!!!! I have a website that is done nearly all in
    Flash with AS2.0. I recently added a video player from a video
    aggregator, but their player is AS3.0.
    All I could do was to build an html page and embed the AS 3
    player into that. I prefer the seamlessness that Flash provides. Is
    there ANY possible way to embed an AS3 swf file into an AS2
    website.
    I just cannot completely rebuild the entire website right now
    in 3.0!!!!
    Is there ANY simple solution? I cannot believe that I am the
    only person who is having issues like this...Ugh!!!!
    thanks for any help you can offer.

    you can't use an as2 file to load an as3 file and have the
    as3 file work.
    you can use getURL() to load your as3's embedding html file.
    if you want it to look seemless, you can load into the same window
    so the user will see your as2 content replaced by the as3 swf.
    in the as3 swf you can put code to load your as2's embedding
    html file (using navigateToURL()). so, you can go back and forth
    between your as2 and as3 swfs.

  • Embed AS3 swf into a AS2 FLA?

    HI, I have a flash site designed in AS2 and want to embed a
    AS3 video player in it. If I republish the AS2 site to AS3 the
    website doesnt function, and if I load the AS3 swf into the
    website, the Player doesnt function.
    I need the AS2 functionality on the website and I need the
    advanced AS3 functionality on the video Player.
    Is there any way to get these two guys to talk to each
    other?

    Creating a 3rd fla, to load the AS2 Fla and the AS3 FLA just
    aint gonna fly. This website is updated daily and its just too much
    of a maintenance nightmare.
    However, I do want to use Wabbits suggestion but I dont know
    how to create a web object.
    The GetURL function opens the swf on its own, which I dont
    want to do. I want it to open the AS3 SWF in a small window within
    the page.
    Can someone help please? Thanks in advance,

  • AS3 parent loading in AS2 child that in turn loads in jpegs *Problem*

    Hiya everybody.
    I'm getting a bald patch on my head from frustration with the following problem.
    I have a parent AS3 swf which loads in a AS2 swf like so;
    stop();
    var ldr:Loader = new Loader();
    ldr.load(new URLRequest( "as2child.swf"));
    addChild(ldr);
    contained in the AS2 file is the following script which loads in jpegs when the user clicks the next button, etc.
    //stuff that loads in different photos
    stop();
    var i:Number = 1;
    //load first image straight away.
    function initialloadup () {
    i = 1;
    startLoading("pic"+i+".jpg");
    initialloadup();
    next_btn.onRelease = function () {
    /*on clicking next image button load next image in sequence*/
    i++;
    if (i > 11 ) {i = 1};
    startLoading("pic"+i+".jpg");
    trace("pic"+i+".jpg");
    prev_btn.onRelease = function () {
    //on clicking previous image button load prev image in sequence
    i--;
    if (i < 1 ) {i = 11};
    startLoading("pic"+i+".jpg");
    function startLoading(whichImage) {
    loadMovie(whichImage, "imageLoader");
    however when you view the AS2 swf via the AS3 swf it does not seem to load in the jpgs when requested.
    I need to retain the AS2 file so cannot rewrite in AS3 as the image loading thing is only a small part of the AS2 file.
    Any ideas? might it be to do with how the AS2 is read in AS3?
    Cheers for your reading this
    Melacroso

    Hi Ned,
    Cheers for your thoughts. I've heard of the lockroot thingymajig. Tried it out but to no avail.
    I've attached a zip file containing the fla's and swf's and jpgs, just incase anyone yourself included might have anymore ideas.
    Thanks for your time
    Alec

Maybe you are looking for