Access child clips of loded SWF

I have a class (Main.as) that uses a Loader object to load an
external SWF in to the root of my main app. I then want to pass a
reference to the loaded SWF to another class in my main app so that
it can access clips on the main timeline of the loaded SWF.
Currently I use a Loader to load the SWF with a handler for
EVENT.INIT, in the INIT handler I send the Loader object to another
class using Event.target.loader.
The second class receives the Loader object and it is here
that I want to use addChild to add a Shape to the loaded SWF and
set it as a mask on a clip on the SWFs timeline. I thought I was
getting there using:
loaderObject.content["clipName"].parent.addChild(maskShape;
but when this runs I get a #1010: A term is undefined and has
no properties.
I am pretty new to AS3 so am quite likely going about this in
a pretty kak handed way so if anyone has any ideas in general on
accessing the child clips and properties of externally loaded SWF
files I would love to hear them.
Thanks a lot all

loaderObject.content is the main timeline of your loaded swf.
if clipName is a child of that main timeline,
loaderObject.content["clipName"] will reference that child.
therefore, loaderObject.content["clipName"].parent will
reference you external swf's main timeline. and then you are trying
to add maskShape to your external swf's main timeline.
where's maskShape? that needs to be accessible to the class
that's executing your code (and it's clearly not, or you wouldn't
receive that error).
but beyond that error, i think you're doing things you don't
intend.

Similar Messages

  • Accessing movie clip from flash swf file

    I have the situation where in flash i created a simple
    animated movie clip with few stop() commands on timeline. Movie
    clip consists of simple animatio played on roll over and on roll
    out which is controlled using actionscript. I loaded movie clip
    into flash using [embed] tag but actionscript code is stripped,
    there is no stop() action so movie clip loops continously. I guess
    that's normal behaviour for embedded flash swf files but i would
    like to know is there a way to still achieve that? Can i load swf
    some other way with its actionscript and then control movie clip
    from flex?

    You need the FLA's to open in Flash.
    You could download the free trial of a flash decompiler
    (www.sothink.com). The free trial won't give you actionscript, but
    it will give you all of the art in the swf.

  • Hide movie clip of external swf

    Hi there.
    I have my main.swf and in the second frame i load an external swf called first.swf with this method:
    [AS]var loader:MovieClipLoader = new MovieClipLoader();
    this.createEmptyMovieClip("myGalleryContainerproducts",5);
    myGalleryContainerproducts._lockroot=true;
    loader.loadClip("first.swf",myGalleryContainerproducts);
    myGalleryContainerproducts._y =86;
    myGalleryContainerproducts._x =50;
    [/AS]
    In first.swf i have two movie clips with instance names ena and dyo
    I want in main.swf in the third frame to hide these movie clips of first.swf  (only the movie clips not the whole .swf) or to move them (change x and y values) so they practically hide.
    Any solutions?
    Thank you in advance

    You will need to wait until the file is loaded to be able to interact with it, so if that might be an issue timing-wise then look into using the addListener method of the MovieClipLoader class.  If the movie is loaded you should be able to access the movieclips within it using the movieclip name you assigned (mygalleryContainerproducts) to target them.

  • Error while accessing Child Form process info

    I've created my Process task Adapter and attached it to "AD User" Process Definition.
    When I try to retrieve information about AD Groups from the child form of UD_AD_USER (form named AD_RSC), I get the following error:
    ERROR,28 okt 2007 15:08:26,765,[XELLERATE.DATABASE],select obi_key, UD_ADUSER_VERSION from UD_ADUSER where obi_key=5
    java.sql.SQLException: ORA-00904: "OBI_KEY": invalid identifier
    the problem is that there's NO field named OBI_KEY in the standard UD_ADUSER table.
    The same thing happens when I'm trying to access child form data through Xellerate API
    ( getChildFormDefinition(long plParentFormDefinitionKey, int pnParentFormVersion) or getProcessFormChildData(long plChildFormDefinitionKey, long plProcessInstanceKey) )
    is it some king of bug? I haven't found anything at metalink :(

    I have no issues getting child table information using the APIs... I am doing it on both 9.0.1.X versions and 9.0.3.X versions. I would suggest looking at how you are getting the process keys.. (i.e., are you mapping it in through the adapter, getting it from findObjects, etc)... and also look at your configuration of the child tables and make sure everything is active and kosher.
    If you post the rest of your code, I might be able to help you.
    Cheers,
    Deborah

  • SWFLoader loded swf and relative path issue

    Hi,
    Before explaining the problem, let me describe the usecase.
    I have dashboard flex application hosted on Host1.
    I have another flex application which acts as plugin to dashboard and is hosted on Host2.
    I am using proxy to load plugin into dashboard using SWFLoader. With proxy SWFLoader in dashboard thinks that the plugin is coming from same host.
    For plugin to load I specify SWFLoader source something like - source="Proxy/Host2WebappDir/plugin.swf.
    Everything is fine upto this point. plugin.swf get loads successfully without any issue.
    Now the problem -
    If plugin.swf made some request - the url path of that requrest is expected to be relative - i.e. if it make request say getIndianStates.xml, I am expecting the request should look for resource at "Proxy/Host2WebappDir/getIndianStates.xml". Instead it tries to look for getIndianStates.xml into dashboard hosting directory on Host1.
    Can this issue be resolved without making any modification in source of plugin.swf.
    Thanks in advance,
    Prithveesingh Zankat.

    I don’t know if any way to fix this without changing the URL the plugin wants to load.  Now if the plugin stores that URL in a publicly accessible variable, you might be able to access it from the main SWF and change it.  But it would be better to have the plugin detect relative paths and make sure they are relative to the SWF.  The SWFLoader component uses a LoaderUtil class to do that for SWFs it loads, but loads that don’t use SWFLoader need similar fix ups.

  • Loading movie through button from child clip

    I have a portfolio page with several trailer thumbnails (a portfolio list). If you click on each, the page changes and you see the trailer in a video player, plus more info about the film. I used two frames in the timeline: the first frame has the clip with the thumbnails (port_list). The second frame has a movie clip container and the video player. The idea is that pressing the respective button from port_list will load the details of that movie and the movie into the video player. I am using this script:
    ZSQ_but.onRelease = function (){
    _parent.gotoAndStop("por_details");
    _parent.myplayer.contentPath = "videos/ZSQ.flv";
    _parent.por_details_cont.attachMovie("ZSQ_details","ZSQ_de tails",0);
    Even though the script looks alright (and works alright if at the root level), it will not work from the child clip. What am I doing wrong?? Please see the attached fla file. Somone hinted that the AS for loading the player and the container is not on the frame where the player and the container are. If that is the reason, how can I address this issue?

    if 'movie' is just a layer on the timeline you do not need to
    reference it in your path.
    Just use _root.chapters.gotoAndPlay(2);
    paths only need to reference nested levels of
    movieclips

  • Problems accessing child swf from parent class

    First off: Hi. I'm new - to the forum and to Flash.
    I'm currently writing a flash app that requests a XML feed
    from a Java controller and loads child swfs into various parts of
    the stage based on the settings/URL details received from the XML
    feed.
    Its nearly there and I've got my head round a couple of weird
    things, but theres one thing left that I've found impossible to
    solve. Once the loader class has loaded the swf, it can't access
    its methods or set its variables and the child can't access the
    parent either (or access the parent's variables full stop). From
    what I've read this should be possible. Heres some of my code plus
    pseudo code:
    Note the Panel class is not linked to a symbol and uses
    composition to act like a movie clip, rather than inheritance.
    quote:
    class Panel{
    function Panel(owner:MovieClip, insName:String,
    depth:Number){
    initiates properties etc....
    panelMovie = owner.createEmptyMovieClip(insName,depth);
    listener.onLoadComplete = mx.utils.Delegate.create(this,
    scheduleModule);
    loader.addListener(listener);
    loader.loadClip(moduleX.url, panelMovie);
    function scheduleModule(){
    trace(panelMovie.key);
    trace(panelMove.keyTest());
    panelMovie.key = "dave";
    trace(panelMovie.key);
    Child swf:
    quote:
    var key:String = "test";
    As you can see I create an empty movieclip which I store a
    reference to in this class under the field "panelMovie". I then use
    this (instead of target_mc like you might do with an event handler)
    to try to access the child swf. The output is:
    trace(panelMovie.key); = "test" (Works fine)
    trace(panelMove.keyTest()); = (Nothing returned)
    panelMovie.key = "dave";
    trace(panelMovie.key); = "test" (Previous line = no effect)
    Is this something related to using a class? Really would be
    preferentially to keep all code outside of the fla.
    I've also tried a lot of different combinations of _root,
    _parent and _levelx. None of which I truly understand.
    Any help would be much appreciated! Plus any good tutorial
    links on timeline and referring to objects in it!
    (Couldn't find the code tag/button...)

    >>trace(panelMove.keyTest()); = (Nothing returned)
    You have panelMove here instead of panelMovie
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Accessing resources in loaded/external SWFs

    I've been looking around for an effective way of solving this
    issue, but without much like. What I'm trying to accomplish is
    creating a container for my newest Flash site in main.swf and
    loading other swf files that provide resources that modify mcs,
    functions etc. of the main.swf. I plan to have main.swf hold my
    background, logo etc. then each subrelated page as contact.swf,
    index.swf to be placed on top of that swf.
    I did find this thread:
    http://www.kirupa.com/forum/archive/index.php/t-241538.html
    but all I managed to get from it is how to reference elements in
    the child from the parent using Loader.content. What I'm trying to
    figure out is how to reference from the child to the parent. ie. if
    I want to modify the background of the main.swf which is contained
    in a function called changeBackground().
    To add some more complexity I am trying to keep as much of my
    code in .as files that are placed in the Document class. So for
    each main.fla I have a main.as and index.fla is index.as. In my
    index.as script I need to determine how to access objects/functions
    contained in main.as.
    I HOPE that I've explained that all properly. If I'm being
    confusing or using inappropriate terms - apologies.

    First, you need a loadComplete function in your icMain class
    to get called after the swf is loaded. You set up that relationship
    already in this line:
    indexLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    loadComplete);
    so you need this:
    private function loadComplete(event:Event):void
    then, move these functions into the loadComplete function as
    you have to wait until the swf is loaded before setting the
    reference:
    var indexPage:indexPage = indexLoader.content as indexPage;
    indexPage.icMain = this;
    In your indexPage class, you need to move your set mainSWF
    function outside of the indexPage function. Also, the type of
    object you are passing, according to your code, should be icMain.
    So, instead of this:
    public function indexPage():void
    public function set mainSWF(icMain:MainSWFDocumentClass):void
    _icMain = icMain;
    Do this (notice I changed the name of your variable to avoid
    name conflict. using the convention of starting class names with a
    Capital letter would help too):
    private var _mainSWF:icMain;
    public function indexPage():void
    public function set mainSWF(mainSWF:icMain):void {
    _mainSWF = mainSWF;
    Here is the rewritten icMain class:
    package
    public class icMain extends Sprite
    public function icMain():void
    var indexRequest:URLRequest = new
    URLRequest("index/index.swf");
    var indexLoader:Loader = new Loader();
    indexLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
    loadProgress);
    indexLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    loadComplete);
    indexLoader.load(indexRequest);
    private function loadComplete(event:Event):void
    var indexPage:indexPage = indexLoader.content as indexPage;
    indexPage.icMain = this;
    And here is your rewritten indexPage class:
    package {
    public class indexPage extends Sprite
    private var _mainSWF:icMain;
    public function indexPage():void
    public function set mainSWF(mainSWF:icMain):void {
    _mainSWF = mainSWF;

  • Access a component inside external swf file

    Hi, I loaded a external swf file that it is a dialog.
    var swfLoader : Loader = new Loader();
    var swfURL : URLRequest = new URLRequest("dialog.swf");
    swfLoader.load(swfURL);
    swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,imgLoaded);
    function imgLoaded(event:Event):void
    var movie : * = swfLoader.content;
    var clip : MovieClip = movie;
    parent.addChild(clip);
    Now, inside the movieClip there is a TextField component
    named message that i want to change its 'text' property.
    The question is: How can i access to this property to change
    it?
    Regards

    okay,
    I have the image component in ProductCatalogThumbnail.mxml, which has an id of "img"
    so, i created a public variable in the file and a public function that returns the value of the object.
    public var imagecopy:Object;
            [Bindable]
             public function imagecopyfunction():Object{
             imagecopy  = img;
             return imagecopy;
    now, I want to access this image in the mxml file ProductList.mxml in a function
      public function init():void
          ProductCatalogThumbnail.imagecopy.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
         // accepting a drag/drop operation...
           this.area.addEventListener( DragEvent.DRAG_ENTER, acceptDrop );
           // handling the drop...
          //this.area.addEventListener( DragEvent.DRAG_DROP, handleDrop );
    I tried to use the variable, and then i tried to use the function:
    I got this error when I tried the variable : 1119: Access of possibly undefined property imagecopy through a reference with static type Class.
    ProductCatalogThumbnail.imagecopy.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
    and this error when i tried the function:  1061: Call to a possibly undefined method imagecopyfunction through a reference with static type Class.
    ProductCatalogThumbnail.imagecopyfunction().addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
    i made sure i imported ProductCatalogThumbnail file in the beginning of my application.
    I am not sure what went wrong.

  • ScaleMode.NONE results in clipping/masking of SWFs

    I'm loading an SWFElement into my player and when the LayoutMetadata is set to ScaleMode.NONE with left, right, top, and bottom attributes set to 0, the SWF does not fill the stage like I would expect when setting L,R,T,B to 0. Setting the LayoutMetadata's width or height forces the media element to scale.
    What I'd like to do is not have the SWF clipped or masked off at it's bounds. It appears that if I load a 300x400 SWF into a player that's 500x600, with attributes L,R,T,B set to 0 and ScaleMode to NONE the SWF sits at the top left of the player and anything in the swf that sits outside it's original 300x400 area is invisible. But if I load this swf into the player using a Loader and add it as a child to the stage (not the MediaContainer) it is not clipped. Is the LayoutRenderer clipping it? I don't see anywhere in the OSMF classes where masking is happening.

    Making this change solved the problem for SWFElements loaded into the player as media, but if I try to add metadata to it and load it as a plugin it still clips. Removing the addMetadataValue from the swf plugin resource data removes the clipping issue:
    var resource:MediaResourceBase = new URLResource(url);
    resource.addMetadataValue(SocialPlugin.NS_SOCIAL_SETTINGS, socialSettings);
    socialElement = factory.createMediaElement(resource);
    Does that make any sense?

  • Accessing AIR API from loaded SWFs

    I am relatively new to AIR development and I can't get my head a round a little issue. I have an AIR application created in Flash CS5 that is just a shell that loads modules on demand, those modules are just SWF.
    I would like to access the AIR API directly from the classes of those SWF but of course they don't compile because in the publish settings they are just exported for Flash player 10 and don't see the AIR API. I tried adding airglobal.swc to the library hoping it would sort out the compiling problem but it doesn't and it generates many errors.
    I use to develop with MDM ZInc and I would just import the MDM SWC in any classes that would want access the MDM API, I am unsure how to proceed with AIR.
    Any help would be appreciated.
    Calwen

    Hi Calwen,
    here is basic sample how you could achieve that. Note: I'm using mxml syntax and components - but the *KEY* is api use of LoaderContext - not what real components are used to model UI.
    Say I have host:
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:s="library://ns.adobe.com/flex/spark"
                                xmlns:mx="library://ns.adobe.com/flex/mx"
                                creationComplete="creationCompleteHandler(event)">
         <fx:Script>
              <![CDATA[
                   import mx.events.FlexEvent;
                   protected function creationCompleteHandler(event:FlexEvent):void
                        var loaderContext:LoaderContext = new LoaderContext();
                        loaderContext.allowCodeImport = true;
                        swfLoader.loaderContext = loaderContext;
                        swfLoader.load("app:/MyLoadedApp.swf");
              ]]>
         </fx:Script>
         <s:SWFLoader id="swfLoader" width="100%" height="100%"/>
    </s:WindowedApplication>
    MyLoadedApp is not created with air SDK at all - it is just flash.display.Sprite movie clip created with any compatible Flash compiler:
    package
         import flash.display.Sprite;
         import flash.events.*;
         import flash.text.TextField;
         import flash.utils.getDefinitionByName;
         public class MyLoadedApp extends Sprite
              public function MyLoadedApp()
                   addEventListener(Event.ADDED_TO_STAGE, initApp);
              protected function initApp(addedToStageEvent:Event):void
                   removeEventListener(Event.ADDED_TO_STAGE, initApp);
                   var clazz:Class = flash.utils.getDefinitionByName("flash.filesystem.File") as Class;
                   if(clazz)
                        // we could read documents directory (File.documentsDirectory) using class access
                        var directory:Object = clazz.documentsDirectory;
                        try
                             // and we could show browse dialog (now we are using instance - not class)
                             directory.addEventListener(Event.SELECT, directorySelectedHandler);
                             directory.browseForDirectory("Please select directory");
                        } catch (error:Error)
                             // handle error
                             var errorText:TextField = new TextField();
                             errorText.autoSize = "left";
                             errorText.text = error.message;
                             addChild(errorText);
              protected function directorySelectedHandler(selectEvent:Event):void
                   var directory:Object = selectEvent.target;
                   var files:Array = directory.getDirectoryListing();
                   var resultsTextField:TextField = new TextField();
                   resultsTextField.autoSize = "left";
                   resultsTextField.multiline = true;
                   resultsTextField.appendText(selectEvent.type+":\n");
                   for(var i:uint = 0; i < files.length; i++)
                        resultsTextField.appendText(files[i].name+"\n");
                   addChild(resultsTextField);
    This is not safe at all and loaded module can do everything I think (we talk about local modules from app storage, like in Zinc, right?)
    kind regards,
    Peter

  • Problem accessing child object and changing its appearance (color)

    For a program, I need to be able to access a child object (in this case a box) after adding it to a transform group and change its appearance, for example the color of its top face. I have included a small code example to show my problem. The box is the only child I have added to the TransformGroup, but when I call getChild(), it returns a node, and thus I can't then call getShape() to get the top face and change its appearance. What am I doing wrong?
    public BranchGroup createSceneGraph() {
         BranchGroup objRoot = new BranchGroup();
         Transform3D rotate = new Transform3D();
         Transform3D tempRotate = new Transform3D();
    rotate.rotX(Math.PI/4.0d);
         tempRotate.rotY(Math.PI/4.0d);
    rotate.mul(tempRotate);
         TransformGroup objRotate = new TransformGroup(rotate);
         objRoot.addChild(objRotate);
         Appearance ap = new Appearance();
         Appearance app = new Appearance();
         Appearance apr = new Appearance();
         ColoringAttributes colr = new ColoringAttributes();
         ColoringAttributes colg = new ColoringAttributes();
         colr.setColor((float)1, (float)0, (float)0);
         ap.setColoringAttributes(colr);
    colg.setColor((float)0,(float)1, 0);
         apr.setColoringAttributes(colg);
         Box box = new Box((float)0.4, (float)0.4, (float)0.4, app);
         box.getShape(4).setAppearance(ap);
         objRotate.addChild(box);
         objRotate.getChild(0).getShape(4).setAppearance(ap);
    objRoot.compile();
         return objRoot;
    }

    It would help if you gave us the following System information:
    Operating System/version
    Photoshop version number
    Amount of RAM installed
    Hard drive(s) capacity
    Make and model number of video card
    Also try resetting your preferences as described in the FAQ.
    http://forums.adobe.com/thread/375776?tstart=0
    You either have to physically delete (or rename) the preference files or, if using the Alt, Ctrl, and Shift method, be sure that you get a confirmation dialog.
    This resets all settings in Photoshop to factory defaults.
    A complete uninstall/re-install will not affect the preferences and a corrupt file there may be causing the problem.

  • Tree Control Property Node for Accessing "Child Text" String Array

    When adding items to a tree control using the EditTreeItems invoke nodes, the inputs include "Child Tag", "Item Indent", "Child Only?", "Glyph Index", "Child Text", and "Left Cell String" as can be seen in this screenshot.
    There are property nodes for the tree control for accessing each of these elements, except for the "Child Text", which is an array of strings. It is possible to access this data as outlined in this forum post, but this method is somewhat involved and round about. 
    I suggest that a property for the Tree class be created to access the Child Text array directly.

     The work around only works if you do not have an empty string element some where in the middle.
    At lest could the "Active Celltring Property" read return an error when you have gone beyond the end of the array.

  • Prevent Active Directory Parent Domain Admins from accessing Child Domain

    We want to prevent Parent domain administrators (or a similar profile?) from accessing and/or administering child domains. Is this possible, or do parent domain admins have irrevocable administrative access to any child domain?
    Asked another way, can a restricted profile be configured for administration of the parent domain that does not cross domain boundaries effectively isolating each domain's administrative needs?
    Thanks in advance for input and advice!
    Best regards.

    Sorry, I was replying again after I read your second paragraph. The parent domain is the Forest root. we have parentdomain.com
    parent.parentdomain.com
    child1.parentdomain.com
    child2.parentdomain.com
    child3.parentdomain.com
    We do not want the Domain Administrator for parentdomain.com to be able to administer, or preferably, even access the Child Domains.
    1.) Can we remove that user from "Enterprise Admin" role and assign a different role so that they can only administer parentdomain.com (effectively demoting that user)?
    2.) Promote a Child.parentdomain.com user to Enterprise Admin?
    Thanks sorry for the confusion.
    Ah ok.
    Yes, you can. the answer is the same basically. The group membership is what counts. So in the child domain, remove the enterprise admins group from the child domain admins groups. OR make sure the domain admins of the forest root are not members of the
    enterprise admins group. that way they are still only admins in the parent domain.
    It is really only depending on group members ship and including those groups in the child domain. by default the enterprise group is included for example, but nothing stops you from removing those groups.
    based on the group membership you can also deny them the ability to log on.
    the only thing you cannot prevent is the forest administrator account from doing something.
    One thing I would like to add though: any admin in the forest domain likely has the ability to still get access if he wants to force his way in.

  • Could a SAXParser access child nodes, How?

    Hi All!
    i am desiging a saxparser for my xml db. Right now my parser accesses/searches for text/attributes etc. for the very next nodes of the root node. But not the next child nodes.
    i need to search for a node (whether root, parent or child) for its text and attributes. How could i access that?
    I will greatly appreciate Urgent replies !

    http://forum.java.sun.com/thread.jsp?forum=34&thread=330347&tstart=0&trange=15

Maybe you are looking for

  • How do you view all open images without opening each tab?

    I have been using CS2 for ages, and recently switched over to a recent version of Photoshop. I'm using a mac. In CS2 I was able to drag my mouse to a corner of the screen and view all open files. Can I still do this somehow? Or do I have to open each

  • Mavericks and Airplay issues

    I just installed new updates for Mavericks, not the OS itself, just the automatic updates. Now my airplay won't mirror from my computer. It will not allow me to change from "extend desktop" to "mirror". I am getting sound on my TV from whatever I am

  • Can a firewire iPod Mini be changed to USB?

    I've just bought a new MacBook. My older Mac is a Mac Mini and my iPod Mini connects to it via Firewire. Can I simply get a USB iPod cable to connect the iPod to the MacBook? Or is there anything else I can do to use the iPod with the MacBook?

  • Group By limit on Apex 4 interactive reports?

    There was a thread on this previously but now archived, group by only allow 3 columns. May I ask is this limit removed or more columns allowed in the latest Apex (4.2.4?) ? Thanks, John

  • Why do I get an error that a Youtube video format not supported on the iPad?

    I am trying to view some YouTube videos but am receiving this error. I thought YouTube was compatible.