Loaded SWF & hitTest

Hi,
I have a problem with loaded SWF's and hitTests that use X
& Y. We're using content that originally was loaded into a
Shell SWF at 0,0. All hitTests worked fine.
Now we're creating a new project where this content loads in
a window area that is not at 0,0. Because hitTest using X & Y
uses the Global scope these hitTests now do not work.
Is there a solution to making the hitTest use the scope of
itself? I've tried _lockroot but this didn't solve it. Or is there
another solution?
Regards,
Scott

Scott,
> Now we're creating a new project where this content
loads in
> a window area that is not at 0,0. Because hitTest using
X & Y
> uses the Global scope these hitTests now do not work.
The MovieClip.hitTest() method doesn't really depend on
scope -- unless
I'm misunderstanding your use of the word -- but you might be
facing an
issue that could be addressed with the
MovieClip.localToGlobal() or
globalToLocal() methods.
> Is there a solution to making the hitTest use the scope
of itself?
> I've tried _lockroot but this didn't solve it.
The MovieClip._lockroot property, when set to true,
instructs a loaded
movie clip to interpret any references to _root (in its own
code, that is)
as if it *hadn't* been loaded into another SWF. It doesn't
really affect
the placement (x and y values) of visual objects on the
stage.
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design."

Similar Messages

  • Load SWF file in main SWF with parameters

    Hello everybody,
    I recently got a new flash Application which is a Photo Gallery.
    This App is made of multiple folders (source files), a FLA file, a SWF with its javascript SWFObject and an Html page which instantiate this App with some parameters (size, config file path, ...).
    It needs an XML file to find all the Photos it displays, to do it I need to configure my application in the HTML Page and give it the "xml_path" :
    var so = new SWFObject("index.swf", "gallery", "249", "249", "10", "#111111");
    so.addVariable("xml_path","load/config.xml"); // this line is adding the path to the xml file make sure that it's name is xml_path
    so.addParam("allowfullscreen","true"); 
    so.write("flashcontent");
    By the way, I have a second application, the WebSite, which have to display the Gallery SWF in its "Gallery" page.
    Here is how I do it at the moment (in ActionScript3) :
    var swfRequest:URLRequest = new URLRequest("C:/......../Galerie/index.swf");
    var swfLoader:Loader = new Loader();
    //Charge le SWF Galerie dans le SWF Site
    swfLoader.load(swfRequest, context);
    container1.addChild(swfLoader);
    //Positionne le SWF
    swfLoader.x=10;
    swfLoader.y=120;
    It successfully loads the Gallery application but It shows an error telling me it doesn't find the XML configuration file... In the HTML file I simply had to write the "so.addVariable("xml_path","load/config.xml");" to tell where the XML file is...
    So, my question is : How can I integrate my SWF application giving it some parameters like above, in Action Script 3?
    Thank you ,
    Patrick

    No, nothing with HTML.
    I have 2 SWF applications. One is the Gallery, and the second is my Main Page.
    My Main Page must integrate the Gallery module in one of its page.
    The problem is when I try to integrate it, I think I must give de future loaded SWF some parameters like this :
    (My Main SWF loading in HTML)
    var so = new SWFObject("WebSite.swf", "flashcontent", "520", "700", "10", "#111111");
    so.addParam("allowfullscreen","true");
    so.addParam("allowScriptAccess","always");
    so.addParam("menu","false");
    so.addParam("wmode","opaque");
    so.addParam("bgcolor","#000000");
    so.setAttribute("id","flash");
    so.write("flashcontent");
    It was for the Main App. For my Gallery SWF I had to load it like this (in HTML) :
    var so = new SWFObject("Gallerie.swf", "gallery", "249", "249", "10", "#111111");
    so.addVariable("xml_path","Galerie/config.xml"); // this line is adding the path to the xml file make sure that it's name is xml_path
    so.addParam("allowfullscreen","true"); 
    so.write("flashcontent");
    So at the beginning I had 2 different projects with an HTML page for each.
    Now I wan't to directly integrate the Gallery SWF into the Main SWF. And as you have seen I must give it some parameters such as the "xml_path" and "allowfullscreen". This must be done in ActionScript 3 and I don't know how...
    I think I have to use FlashVars but I don't know how. As I said before, I have tried using the loaderinfo.parameters, but it is in read-only...
    Do you have an idea of how I can make it work ?

  • Using TextSnapshot class on a loaded SWF on an iPad

    Hello, I am creating an iPad app. I am loading SWF files using a Loader object, then placing them in a movieclip and setting a SWFLoaders source property to this clip. Before I add the clip to the SWFLoader control I am using the TextSnapshot class on it, to retrieve an array with the getTextRunInfo method.
    All this works fine when I test it on my desktop machine. However, on the iPad it causes the app to crash when a control using this clip is added to the stage. Can you still use TextSnapshot with an iPad, is there a workaround for this? Thanks for your help.

    We are a university. most of our books are SWF files. We have been using iPad/FlexBuilder 4.5 to successfully view the contents of these books.
    All navigation (i.e gotoandstop(page), etc work fine. Gestures for pageforward/pageback, zoom, pan work fine also.
    Not sure I understand your comment.
    However, there IS a specific problem with text snapshot. Below is a short code piece used to highlight text on a page.
    If you remove the failing line everything works fine.
    If you "debug" the iPad device everything works fine when you execute the code on the iPad
    if you create a release build, when the application starts and the "findtext" line is executed the "app" freezes. No error message. The try/catch does not seem to catch any error.
    This is something we really need for our app. If this is a bug how should we report it.
    Thanks for your help.
      public function highlightText(txt:String):void {
       var start_pos:int = 0;
       try {
        if (txt == null || txt.length == 0) { return; }
        infoMessage("highlightText: " + txt);
        allText = _libMC.textSnapshot;      
        allTexts.push(allText);  // no reason for this but must do to make work 
        start_pos = allText.findText(start_pos, txt, false);     <<<<<< Failing line ====================================
        infoMessage("start_pos: " + start_pos);
       catch (err:Error) {
        infoMessage("error: " + err.message);   
       finally {
        infoMessage("finally");

  • Ipad i have load swf file but swf  is not working proper(flex 4.6) but android is fine to work how

    ipad i have load swf file but swf  is not working proper(flex 4.6) but android is fine to work how

    On the MBP, in iTunes, switch to Song view and enable the iCloud Status column by pulling down View > View options and selecting the option for "iCloud Status." Close the small window. Look for any tracks that have a status of "waiting." If you see several of them disable iTunes Match while holding down the Option key. Quit iTunes, wait a few seconds, then open it again and turn iTM back on. Let it compelete the scan. Wait until all tracks that are "waiting" have a status of either "matched" or "uploaded."
    On the iPad, turn off iTunes Match then launch the Music app and let the contents clear out. Power cycle the iPad for good measure, then re-enable the service once all the tracks in iTunes have been processed.

  • How to unload externally loaded swf which contains 3D Carousel?

    Hello to all
    I am learning AS3 and have been taking on various tutorials found on the net. While learning about AS3 I came across a lesson on http://tutorials.flashmymind.com/2009/05/vertical-3d-carousel-with-actionscript-3-and-xml/ titled "Vertical 3D Carousel with AS3 and XML".
    I completed the tutorial and all worked fine so I then wanted to load the swf into a existing project. The loading of the swf goes fine and when I unload my loader it is removed but only visually as in my output panel in flash CS5 I get an error as follows
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at carousel_c_fla::MainTimeline/moveCarousel()
    this error repeats over and over again slowing my swf movie.
    So does this mean my main flash movie trying to still play / find my unloaded 3D Carousel?
    If so how do I unload remove all the AS3 that is trying to run from the 3D Carousel?
    I have included the AS3 below from the tutorial page and I understand that this is what I have to remove to "break free" from the 3D Carousel swf when it is unloaded. This is where I am stuck as my knowledge of AS3 is limited - Can you guys / girls help?
    //Import TweenMax
    import com.greensock.*;
    //The path to the XML file (use your own here)
    // old var from tutorial - var xmlPath:String = "http://tutorials.flashmymind.com/XML/carousel-menu.xml";
    var xmlPath:String = "carousel-menu.xml";
    //We'll store the loaded XML to this variable
    var xml:XML;
    //Create a loader and load the XML. Call the function "xmlLoaded" when done.
    var loader = new URLLoader();
    loader.load(new URLRequest(xmlPath));
    loader.addEventListener(Event.COMPLETE, xmlLoaded);
    //This function is called when the XML file is loaded
    function xmlLoaded(e:Event):void {
         //Make sure that we are not working with a null variable
         if ((e.target as URLLoader) != null ) {
              //Create a new XML object with the loaded XML data
              xml = new XML(loader.data);
              //Call the function that creates the menu
              createMenu();
    //We need to know how many items we have on the stage
    var numberOfItems:uint = 0;
    //This array will contain all the menu items
    var menuItems:Array = new Array();
    //Set the focal length
    var focalLength:Number = 350;
    //Set the vanishing point
    var vanishingPointX:Number = stage.stageWidth / 2;
    var vanishingPointY:Number = stage.stageHeight / 2;
    //We calculate the angleSpeed in the ENTER_FRAME listener
    var angleSpeed:Number = 0;
    //Radius of the circle
    var radius:Number = 128;
    //This function creates the menu
    function createMenu():void {
         //Get the number of menu items we will have
         numberOfItems = xml.items.item.length();
         //Calculate the angle difference between the menu items (in radians)
         var angleDifference:Number = Math.PI * (360 / numberOfItems) / 180;
         //We use a counter so we know how many menu items have been created
         var count:uint = 0;
         //Loop through all the <button></button> nodes in the XML
         for each (var item:XML in xml.items.item) {
              //Create a new menu item
              var menuItem:MenuItem = new MenuItem();
              //Calculate the starting angle for the menu item
              var startingAngle:Number = angleDifference * count;
              //Set a "currentAngle" attribute for the menu item
              menuItem.currentAngle = startingAngle;
              //Position the menu item
              menuItem.xpos3D = 0;
              menuItem.ypos3D = radius * Math.sin(startingAngle);
              menuItem.zpos3D = radius * Math.cos(startingAngle);
              //Calculate the scale ratio for the menu item (the further the item -> the smaller the scale ratio)
              var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
              //Scale the menu item according to the scale ratio
              menuItem.scaleX = menuItem.scaleY = scaleRatio;
              //Position the menu item to the stage (from 3D to 2D coordinates)
              menuItem.x = vanishingPointX + menuItem.xpos3D * scaleRatio;
              menuItem.y = vanishingPointY + menuItem.ypos3D * scaleRatio;
              //Add a text to the menu item
              menuItem.menuText.text = item.label;
              //Add a "linkTo" variable for the URL
              menuItem.linkTo = item.linkTo;
              //We don't want the text field to catch mouse events
              menuItem.mouseChildren = false;
              //Assign MOUSE_OVER, MOUSE_OUT and CLICK listeners for the menu item
              menuItem.addEventListener(MouseEvent.MOUSE_OVER, mouseOverItem);
              menuItem.addEventListener(MouseEvent.MOUSE_OUT, mouseOutItem);
              menuItem.addEventListener(MouseEvent.CLICK, itemClicked);
              //Add the menu item to the menu items array
              menuItems.push(menuItem);
              //Add the menu item to the stage
              addChild(menuItem);
              //Assign an initial alpha
              menuItem.alpha = 0.3;
              //Add some blur to the item
              TweenMax.to(menuItem,0, {blurFilter:{blurX:1, blurY:1}});
              //Update the count
              count++;
    //Add an ENTER_FRAME listener for the animation
    addEventListener(Event.ENTER_FRAME, moveCarousel);
    //This function is called in each frame
    function moveCarousel(e:Event):void {
         //Calculate the angle speed according to mouseY position
         angleSpeed = (mouseY - stage.stageHeight / 2) * 0.0002;
         //Loop through the menu items
         for (var i:uint = 0; i < menuItems.length; i++) {
              //Store the menu item to a local variable
              var menuItem:MenuItem = menuItems[i] as MenuItem;
              //Update the current angle of the item
              menuItem.currentAngle += angleSpeed;
              //Calculate a scale ratio
              var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
              //Scale the item according to the scale ratio
              menuItem.scaleX=menuItem.scaleY=scaleRatio;
              //Set new 3D coordinates
              menuItem.xpos3D=0;
              menuItem.ypos3D=radius*Math.sin(menuItem.currentAngle);
              menuItem.zpos3D=radius*Math.cos(menuItem.currentAngle);
              //Update the item's coordinates.
              menuItem.x=vanishingPointX+menuItem.xpos3D*scaleRatio;
              menuItem.y=vanishingPointY+menuItem.ypos3D*scaleRatio;
         //Call the function that sorts the items so they overlap each other correctly
         sortZ();
    //This function sorts the items so they overlap each other correctly
    function sortZ():void {
         //Sort the array so that the item which has the highest
         //z position (= furthest away) is first in the array
         menuItems.sortOn("zpos3D", Array.NUMERIC | Array.DESCENDING);
         //Set new child indexes for the item
         for (var i:uint = 0; i < menuItems.length; i++) {
              setChildIndex(menuItems[i], i);
    //This function is called when a mouse is over an item
    function mouseOverItem(e:Event):void {
         //Tween the item's properties
         TweenMax.to(e.target, 0.1, {alpha: 1, glowFilter:{color:0xffffff, alpha:1, blurX:60, blurY:60},blurFilter:{blurX:0, blurY:0}});
    //This function is called when a mouse is out of an item
    function mouseOutItem(e:Event):void {
         //Tween the item's properties
         TweenMax.to(e.target, 1, {alpha: 0.3, glowFilter:{color:0xffffff, alpha:1, blurX:0, blurY:0},blurFilter:{blurX:1, blurY:1}});
    //This function is called when an item is clicked
    function itemClicked(e:Event):void {
         //Navigate to the URL that's assigned to the menu item
         var urlRequest:URLRequest=new URLRequest(e.target.linkTo);
         navigateToURL(urlRequest);

    Hi Ned thanks for the reply,
    Ok so I have a button in my main movie that loads the external swf
    stop();
    var my_loader:Loader = new Loader();
    var my_btn:Button = new Button();
    var my_pb:ProgressBar = new ProgressBar();
    my_pb.source = my_loader.contentLoaderInfo;
    my_btn.addEventListener(MouseEvent.CLICK,startLoading);
    function startLoading(e:MouseEvent):void{
    my_loader.load(new URLRequest("carousel.swf"));
    addChild(my_pb);
    my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishloading);
    function finishloading(e:Event):void{
    addChild(my_loader);
    my_loader.addEventListener("killMe",
    killLoadedClip);
    removeChild(my_pb);
    function killLoadedClip(e:Event):void {
    my_loader.removeEventListener("killMe",
    killLoadedClip);
    my_loader.unloadAndStop();
    removeChild(my_loader);
    Then I have a button in my loaded swf that closes the loader
    This is spread over 2 frames
    Frame1
    function closeIt(e:MouseEvent):void {
    parent.dispatchEvent(newEvent("killMe"));
    Frame 2
    back_btn.addEventListener(MouseEvent.CLICK, closeIt);
    Frame 2 also holds all the code for the carousel
    Thanks for your time and help in advance people ; )

  • Loaded SWF not displaying

    I've created a 'plugin' SWF file in CS3 using actionscript 3.
    The purpose of this file is to be included as a postroll in the
    open source flash media player JW FLV/Media Player (
    http://www.jeroenwijering.com/?item=JW_Media_Player).
    I have heavily customized the media player libraries to do
    various new things/alter how things worked, and now want to be able
    to include the SWF file within this into a child sprite/movie clip.
    HOWEVER, the problem lies in that the media player is written
    completely in AS2, and therefore I have to use the MovieClipLoader
    class to load in the SWF. Updating the source to AS3 isn't an
    option unfortunatly, and downgrading the AS3 SWF to AS2 isn't an
    option either, mainly due to the fact I've learnt AS3, not AS2, and
    find it frustrating trying to find the AS2 equivalent to the AS3
    methods I know.
    The problem though lies in that MovieClipLoader does not like
    my SWF at all. Initially I was presented with a load of sandbox
    errors from when it was loaded in, which I then resolved so that no
    security errors are produced. However, whenever I load in the clip,
    the target sprite/clip is empty. I have gone through checking that
    no errors occur on load, and it reports that the loaded SWF has
    been initialized, yet I see nothing. Also, the code loading the SWF
    is not at fault as it loads any other SWF (even another AS3 SWF
    which just creates a rectangle) no problem.
    Oddly enough, using the MovieClip.loadMovie method works in
    one situation - when you load it into the root of the AS2 file.
    When loading it into an empty movie clip, the same problem of a
    blank clip occurs. The problem is not specific to the media player
    either, as it happened in any AS2 file where I was testing how to
    load in the AS3 SWF.
    If it is of any use, the sandbox errors produced by the AS3
    file when loaded into AS2 swf I had to resolve where to do with
    stage access for getting the stage height and width, and a
    Loader.content error when pulling out the BitmapData. These were
    resolved via setting the allowed domains policy and eliminating any
    reference to stage.stageHeight/With.
    Does anyone have any ideas on how to solve this? The only
    possible solution I've been able to think of so far since the AS3
    swf won't display is to play with the LocalConnection class as
    tests showed I can communicate between the AS2 and AS3 files, but
    this would have to be a last resort, and is less than ideal when
    there can be multiple instances of the player running (I would need
    to use unique connection names for each instance so as to prevent
    player A interacting with player B, and also as only one of the
    players can listen on the connection at once).

    I have the component in the top level also,
    I get this error:
    TypeError: Error #2007: Parameter child must be non-null.
              at flash.display::DisplayObjectContainer/addChildAt()
              at fl.controls::BaseButton/drawBackground()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\BaseButton.as:615]
              at fl.controls::LabelButton/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\LabelButton.as:724]
              at fl.core::UIComponent/drawNow()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1343]
              at fl.controls::List/drawList()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:594]
              at fl.controls::List/draw()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\List.as:474]
              at .tree::TreeList/draw()
              at fl.core::UIComponent/callLaterDispatcher()[C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\User Interface\fl\core\UIComponent.as:1532]
    I've checked the definitions for the tree component,
    The LabelButton and List I don't have much control over.
    I'm not sure how to fix this.  The xml is correct and loads easily if it's in the root document.
    The list component doesn't load the labels, It stops on the first one.
      What do I do next?

  • How to effectively remove a loaded SWF from the stage?

    I can not figure out a proper coding to remove a loded SWF from the stage.
    Here is my set up.
    I have a layout segmented into labeled section. In the section labeled "products" I have a layout consisting of product images acting as buttons which bring a user to another labeled section "prdctsPopUps"
    In the "prdctsPopUps" section I have placed an instance of LoaderMax placed into an mc container. Placing LoaderMax into an mc container automatically resolved an issue of clearing loaded SWFs from stage when I come back to "products" section.
    I specified the variable in the "products" section with the following set up:
    var sourceVar_ProductsPopUps:String;
    function onClickSumix1PopUp(event:MouseEvent):void {
                        sourceVar_ProductsPopUps="prdcts_popups/sumix1-popup_tl.swf";
                        gotoAndPlay("prdctsPopUps");
    So each button has its own "....swf" URL and they all open fine and I can come back to "products" section without any issues.
    However inside the swf (which loads through LoaderMax which is placed into an mc) there are other buttons which bring a user to labeled section "xyz". Which also functions properly. It opens as it is supposed to be and without any previously loaded "...swf" on the stage.
    At the labeled section "xyz" there is a limited set of buttons repeating from section "products" which has to bring a user back to the same set up in the "prdctsPopUps" labeled section and open a corresponding "...swf" .
    However only the last opened "...swf" will appear in that section. Effectively the one which was originally opened from the "prdctsPopUps" section and not the one which was supposed to be opened from the "xyz" section.
    I can not understand why it would work from one labeled section and not from another. I can not figure out on which section which code/function needed to be placed.
    Here is the set up from a button from the "xyz" section whcih supposed to bring a user to the same "prdctsPopUps" section but to load a different "...swf"
    var sourceVar_ProductsPopUps_fromXYZ:String;
    function onClick_floralytePopUp_fromXYZ(event:MouseEvent) :void {
                        sourceVar_ProductsPopUps_fromXYZ="prdcts_popups/floralyte-popup_tl.swf";
                        gotoAndPlay("prdctsPopUps");
    Here is the code set up for the LoaderMax from the "prdctsPopUps" section:
    var loaderProductPopUps:SWFLoader = new SWFLoader(sourceVar_ProductsPopUps,
                                                                                                        estimatedBytes:5000,
                                                                                                        container:holderMovieClip,
                                                                                                        onProgress:progressHandler,
                                                                                                        onComplete:completeHandler,
                                                                                                        centerRegistration:true,
                                                                                                        alpha:1,
                                                                                                        scaleMode:"none",
                                                                                                        width:540,
                                                                                                        height:730,
                                                                                                        crop:true,
                                                                                                        autoPlay:false
    function progressHandler(event:LoaderEvent):void{
              progressBarPopUp_mc.gradientbarPopUp_mc.scaleX = loaderProductPopUps.progress;
    function completeHandler(event:LoaderEvent):void{
              var loadedImage:ContentDisplay = event.target.content;
              TweenMax.to(progressBarPopUp_mc, 1.5, {alpha:0, scaleX:0.25, scaleY:0.25});
    loaderProductPopUps.load();
    Is there something which needs to be imported, or specific function needs to be specified in a specific labeled section?

    actually, i think you'll need to use something like:
    var loaderProductPopUps:SWFLoader;
    if ((loaderProductPopUps){
    if(loaderProductPopUps.content)){
       loaderProductPopUps.unload();
    loaderProductPopUps= new SWFLoader(sourceVar_ProductsPopUps, //the value of sourceVar_ProductsPopUps allows to load mulitple SWFs from the products page.
                                                                                                         estimatedBytes:5000 ,
                                                                                                         container:holderMov ieClip,// more convinient and easier to manage if to place the LoaderMax into an empty mc (holderMovieClip)
                                                                                                                                                                         // if not will work as well. Then the line container:holderMovieClip, has to be replaced with container:this,
                                                                                                                                                                         // can be any size, can not be scaled as it distorts the content
                                                                                                         onProgress:progress Handler,
                                                                                                         onComplete:complete Handler,
                                                                                                         centerRegistration: true,
                                                                                                         //x:-260, y:-320, //no need for this is if used: centerRegistration:true,
                                                                                                         alpha:1,
                                                                                                         scaleMode:"none",
                                                                                                         //scaleX:0, scaleY:0,
                                                                                                         //vAlign:"top",
                                                                                                         width:540,
                                                                                                         height:730,//scales proportionally but I need to cut off the edges
                                                                                                         crop:true,
                                                                                                         autoPlay:false
    function progressHandler(event:LoaderEvent):void{
              progressBarPopUp_mc.gradientbarPopUp_mc.scaleX = loaderProductPopUps.progress;
    function completeHandler(event:LoaderEvent):void{
              var loadedImage:ContentDisplay = event.target.content;
              //TweenMax.to(loadedImage, 1.5, {alpha:1, scaleX:1, scaleY:1});//only need this line if corresponding values are changed in SWF loader constructor
              TweenMax.to(progressBarPopUp_mc, 1.5, {alpha:0, scaleX:0.25, scaleY:0.25});
    loaderProductPopUps.load();

  • Last and greatest: conditional statements for click referring to loaded swf

    Hey forum,
    I am so close to being done with this site update it is exciting! I will be sure to throw it up here for you to see, since without this forum I would have been hurting!
    The last big hurdle I have, is the following, and I hope someone can just throw me a bit of guidance on this.
    I am looking for a way to write a function, that on click of my "next" button in the main timeline, will refer to my loaded swf MovieClip(imageLoader.content) telling it to go to the next frame label, so really a compound if/then situation – just referring to the loaded file throws me.
    So, my next button is "pNext," and what I am looking for is something along the lines of:
    if (loaded movie) is on frames 12-144, then go here (on click),
    if (loaded movie) is on frames 144-155, then go here (on click)
    etc. and so forth.
    Thanks so much! Below is my code that works on one next click, so you can see the instances etc.
    b
    pNext.addEventListener (MouseEvent.CLICK, nextClick);
    function nextClick (e:MouseEvent):void{
        MovieClip(imageLoader.content).gotoAndPlay ("aboutS1");

    If I'm reading your request right, what you can try is to create an array of the frame labels in the order they appear and use the currentLabel property to determine where you are and indicate where to go...
    var labels:Array = new Array("one","two","three","four","five"...etc...);
    pNext.addEventListener (MouseEvent.CLICK, nextClick);
    function nextClick (e:MouseEvent):void{
        var mc:MovieClip = MovieClip(imageLoader.content);
        var nextLabel:String = labels[labels.indexOf(String(mc.currentLabel))+1];
        mc.gotoAndPlay (nextLabel);

  • Map and externally loaded swf working together

    Here's the setup:
    I have a panoramic viewer, and i'd like to have a map go
    along side it. The panoramas are loaded externally into the player.
    Inside these external swf files are "hotspots" that link to other
    panoramic swf files that load and take the previous swf's place. I
    have all of this set up, and you can see how I did it in my
    previous post:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1274410&enterthread=y
    So now my new question is... how can I have a map with points
    on it, that when you click on a point, it will load a corresponding
    swf file into the player. I believe that part is easy. My big
    problem is if someone clicks on a hotspot in the external swf file
    first, which in turn loads another swf file, and if that person
    goes back to the map, I want the map to change the position of lets
    say, a marker or a pin to indicate the new position on the map that
    correllates to the new external swf that was loaded.
    make sense? Any ideas? I was thinking maybe it would be some
    kind of listener or something so that should a specific swf load,
    it will recognize it and automatically change the location of the
    marker on the map to the point that relates to the loaded swf or
    something...

    Hi Thanks for your reply, I tried with a small AS3 file as
    well and I get the same ERROR.

  • Trouble Playing A loaded 'SWF' file in the pain timeline

    Hey there. I have created a presentation that loads
    interactive SWF movies into a 'target' movie clip on the main
    timeline.
    As you progress through the presentation different SWF movies
    are loaded into the presentation. And this in turn allows me to
    change the presentations content quickly and easily for different
    clients.
    These SWF's use some of the flash preloaded content objects
    like combo box's and the like.
    However when these SWF's are called into the main
    presentation they cease to work properly.
    They work fine when tested independently of the main
    presentation.
    Does anyone know how I may be able to get these SWF's to work
    properly?
    Cheers Fletch

    The first thing to do is check the scoping in your loaded
    SWF. Any references to _root, for example, mean something different
    once the SWF is loaded into your wrapper movie.
    Also, some of the V2 components don't work properly when
    their SWF is loaded into another SWF. There's a Tech Note and easy
    workaround here:
    http://www.adobe.com/go/tn_19278
    Good luck!

  • Using loadMovie to load SWF linked to FLV

    I am having problems getting a movie (SWF) with an linked FLV
    file to play when I use loadMovie to load it in.
    I have an .FLV file named vid_9.flv. I have embedded it into
    a Flash movie named vid_9.swf using Flash 8 Professional. I am
    using "Progressive Download from a Web Server" and no controls.
    When I play the SWF on the stand-alone player (the FLV is in the
    same folder) it works great. Now when I call that SWF into another
    movie using
    swfHolder.loadMovie("SWFs/vid_9.swf");
    it shows it being completely loaded, but then never plays,
    all I get is a white screen. This is my second project in a row
    where this did not work. Any ideas as to why? Thanks for any
    help.

    onLoadComplete executes before the loaded swf's assets are initialized:  use onLoadInit.
    those function definitions in your loaded swf should NOT be in an onLoad method.  if they are defined on the main timeline of the loaded swf, use:
    var url:String = "scene05.swf";
            var movieClip:MovieClip = createEmptyMovieClip("movieClip", 0);
            var listenerObj:Object = new Object();
            listenerObj.onLoadInit = function (target_mc:MovieClip):Void {
                //It should execute these functions that are located in the onLoad event in the loaded swf.
                target_mc.initBackground();
                target_mc.initBackgroundWeg();
                target_mc.initVehicles();
                target_mc.initForeground();
                target_mc.initKnoppen();
            var movieClipLoader:MovieClipLoader = new MovieClipLoader();
            movieClipLoader.addListener(listenerObj);
            movieClipLoader.loadClip(url, movieClip);

  • How can I get stage width of an loaded swf?

    Is there any way to get the real stageWidth of an loaded swf?
    The problem comes when the loaded swf has some elements outside the scene. In this case content.width becomes bigger then the scene.
    My code looks like this:
    var request:URLRequest = new URLRequest(file.url);
    var loader:Loader = new Loader();
    loader.load(request);
    loader.contentLoaderInfo.addEventListener(Event.INIT, checkSize);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, addImg);
    private function checkSize(e:Event) {
                // this is where I need to see the width of my loaded swf
    trace(e.target.content.width);
    private function addImg(e:Event) {
                    trace("complete");
    Thanks,
    Andrei

    I don't think you can get the stage width of the loaded file unless you assign it as a constant somewhere within the file.  The loaded file forfeits its stage when it is loaded into another swf

  • Loading swf into SWFLoader before it is added to a container

    I want to dynamically load a SWF file, before a particular view is created in a Flex 4.5 mobile app. Is it possible to load a SWF file into a SWFLoader before the SWFLoader is added to a container? I tried this but it didn't work.
    I tried doing this using the AS3 Loader class and movieclips, but when I compile for iOS this method does not work for me. Is there a way to do what I want?

    Hello,
    Firstly, why do you want to do this?
    Secondly, you cannot run runtime-loaded SWF files on iOS devices.
    By that I mean you can probably only use static SWF files like assets, but code inside them will not work.
    If you still want to load it, try inside the initialize event handler.

  • Load SWF into empty movieClip?

    Hello,
    Could anyone please point me in the right direction to find
    out how to load an external SWF into an already existing movieClip
    instance that is already placed on the stage? This is the way I've
    always worked in AS2, but I can't find how to do it in AS3. Can
    anyone point me to an example where URLRequest works with a
    specified movieClip instance?
    Thank you!

    I understand why you might think I was ignoring your advice,
    but this isn't the case. You're expertise is much valued and
    respected.
    My purpose for continuing to experiment with loading into a
    movieClip was an attempt to find an easy way to layer the SWF
    behind other elements, but as you know, although it works for this
    purpose, it doesn't allow control of the loaded SWF from the main
    timeline. For others struggling to learn as I am, here's a link
    where I found the answer to my question above:
    http://www.hostingforum.ca/776586-as3-controlling-loaded-swf.html
    The transition to AS3 is not as easy for some as for others,
    and there are new concepts to understand.
    Don't know what "nvm" means... curious, but might be better
    off not knowing ;) Thanks again for all the help you offer to all
    of us who are struggling.

  • Controlling a Movie Clip on the Main Timeline from a loaded SWF?

    Is it possible to control a MovieClip on the main timelne from another loaded clip?
    I see posts that control loaded clips, but most are all from the loader in the main timeline.  I have a moviclip on the main timeline that I want to make visible or invisible depending on what keyframe is playing in another loaded swf.
    If I try to call the movieClip from the loaded SWF I get "error #1119.  Access of possibly undefined property...." because it doesn't exist in the loaded SWF, just the main timeline. 
    The old AS2 way just used "_root".  Since "_root" doesn't exist any more, how do you control items on the main TimeLine from a loaded SWF?

    I am not clear what you mean because you are saying you are trying to target a movieclip that does not exist where you are trying to target it.
    Try using a trace to see what you are targeting when you you target the MovieClip(parent.parent)....
    trace(MovieClip(parent.parent));
    The other approach I mentioned earlier is the more OOP-correct approach if you would rather try that way.  Here's a rough outline of it...
    AS3 - Dispatch Event
    http://forums.adobe.com/thread/470135?tstart=120
    Example:
    Add something to trigger the event in the child (your loaded swf):
    dispatchEvent(new Event("eventTriggered")); (
    if dispatchEvent problem, see: http://www.kirupa.com/forum/showthread.php?p=1899603#post1899603)
    In your loading/parent swf, listen for the complete event on the Loader.contentLoaderInfo.  In the complete event handler, add a listener for the event on the loaded swf.
    // event handler triggered when external swf is loaded
    function loaderCompleteHandler(event:Event) {
        MovieClip(event.currentTarget.content).addEventListener("eventTriggered", eventHandler);
    function eventHandler(event:Event):void {
        trace("event dispatched in loaded swf");
       // this is where your main file can set the visible property of your movieclip

Maybe you are looking for

  • Reinstalling, Application Manager says the serial number is invalid.

    Let's start at the beginning: my hard drive crashed and I got a new one in my desktop iMac. I was able to save most of my files to an external harddrive, but none of my programs. I knew from previous experience with Adobe products that I could downlo

  • Print program for delivery output printing

    Hi, I need help with creating a custom smart form and print program for outbound delivery. 1. i want to know how to select data in my print program ? i mean how to i get the delivery number when the output type is executed. 2. What parameters are to

  • Editable Title Bar in a JFrame?

    I have a standalone application that launches a JFrame. Is there some way to allow the user to set the title of the JFrame?

  • Linksys WRT54G3G-ST and Sony Ericsson GC89 Compability?

    Is the WRT54G3G-ST compatible with the Sony Ericsson GC89 EDGE/Wireless LAN PC Card? My Broadband Internet provider uses only this card and WRT54G3G-ST appears to solve some our problems. I have been asking my Broadband provider to confirm if the GC8

  • Connect iPad Air to external display

    Can I connect an iPad Air to an LCD projector? Can I connect it with an HDMI cable?