Can't Access MovieClips and Functions in Loaded SWF

Hi everybody,
I'm trying to simply access anything inside this loaded SWF and all I get is 'null'.
I have code in the parent SWF that needs to tell the child SWF movieclip what to do but nothing works. This was a piee of cake in AS2 and I can't seem to get anything to crossover in AS3.
Here's my code:
import com.greensock.TweenMax;
import flash.display.MovieClip;
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf"); // in this case both SWFs are in the same folder
myLoader.load(url);  // load the SWF file
panel2.addChild(myLoader);   // add that instance to the display list, adding it to the Stage at 0,0
panel2 = myLoader.content as MovieClip;
photo_about.alpha = 0;
photo_downloads.alpha = 0;
//panel2.content_about.alpha = 0;
//panel2.content_downloads.alpha = 0;
function closeSection():void
          panel2.controlsMC.forcePause();
          TweenMax.to(photo_about, .5, {alpha:0});
          TweenMax.to(photo_downloads, .5, {alpha:0});
          TweenMax.to(photo_home, .5, {alpha:0});
          TweenMax.to(panel2.content_about, .5, {alpha:0});
          TweenMax.to(panel2.content_downloads, .5, {alpha:0});
          TweenMax.to(panel2.controlsMC, .5, {autoAlpha:0});
          TweenMax.to(panel2.content_home, .5, {alpha:0});
panel2 traces null and all the clips loaded within pull up undefined property errors.
Can somebody please tell me what I'm doing wrong? I'd be stoked to know what I'm missing and feel like this should be a piece of cake.
Thanks for any help!

You are not adding the content to the stage at 0,0, you are adding it to panel2 at 0,0.  THen you take panel2 and assign it to be something that likely doesn't exist by the time you assign it.  You need to wait until the loader completes loading before you attempt to do anything with its content, otherwise it has no content (null).  Similarly, you cannot control anything in the loaded swf until it has finished loading.  So assign an event listener to the contentLoaderInfo property of the Loader to determine when loading is complete, and have the event handler function deal with starting the interaction with it.
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf");
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, processLoadedSWF);
myLoader.load(url);
function processLoadedSWF(evt:Event):void {
    // deal with the loaded swf here
    // but you don't want to be assigning it to the panel2 object that contains the loader
As far as controlling anything inside the swf you load, is it an AS1/2 or an AS3 swf?

Similar Messages

  • Accessing variables and functions between loaded external swfs?

    Using AS 3.0: Say I have a menu.swf that loads a content.swf
    below it using the following
    var newContent:Loader = new Loader();
    newContent.load(new URLRequest("fowContent.swf"));
    addChildAt(newContent,0);
    Now say I have a frame label in newContent that is an
    animation ending the display of that swf. Upon clicking of another
    menu button in menu.swf, can I access the content's ending sequence
    by:
    newContent.gotoAndPlay(newContent.endingSequence);
    Also can you use while loops in AS 3.0? I would like to have
    a boolean variable "ended" in the newContent that becomes true
    after the ending animation has played.
    while ( newContent.ended != true)
    //wait
    then have it run the function to load and display the new
    content.swf

    quote:
    Originally posted by:
    kglad
    p.s. you can't use a for-loop and you can't use a while-loop
    to effect any time delays. they both execute from beginning to end
    before anything is updated on-stage and no other code can execute
    outside of those loops (unless called from within the loop).
    Thank you very much for the help.
    Would I need to declare a MovieClip variable before using
    that statement or does that automatically cast newContent as a
    movieclip and go to the frame?
    So in order to achieve the flow I'm looking for.
    I'll have this in the menu.swf looking for clicks. It will
    run a function in the content.swf that runs the ending sequence and
    receives a string variable which is a concatenation of the
    buttonclicked (which is also the filename of next content) and
    .swf. (can I cast the event.target.name into a string the same way
    you casted the other into a movieclip?)
    function buttonClick(event:MouseEvent):void //in the menu.swf
    var nextFile:string = string(event.target.name) + ".swf";
    MovieClip(newContent.contentLoaderInfo.content).endSequence(nextFile)
    fowContent.addEventListener(MouseEvent.CLICK, buttonClick);
    In the content.swf I will have a public variable nextContent
    and the function that the menu.swf calls, which begins the ending
    sequence.
    public var nextContent:string;
    function endSequence(nextFile:string)
    nextContent = nextFile;
    gotoAndPlay(endingSequence);
    Then at the end of the movie sequence I could call this
    function that passes back the variable that was modified by the
    previous function and runs the loader.
    parent.loadNext(nextContent) //in the content.swf
    function loadNext(nextContent:string) //function in menu.swf
    newContent.load(new URLRequest(nextContent));
    addChildAt(newContent,0);
    I'm sure theres a better way to do this, and I don't even
    know if this will work. But I'd like to make sure it makes sense
    before I try to implement it.

  • Can't access instances and functions in MC

    In this example, the code works fine on properties of a
    dynamically generated MC (alpha, name, etc...). However, it fails
    to access anything inside of the same MC (textFields, functions
    etc).
    Why?

    You are not adding the content to the stage at 0,0, you are adding it to panel2 at 0,0.  THen you take panel2 and assign it to be something that likely doesn't exist by the time you assign it.  You need to wait until the loader completes loading before you attempt to do anything with its content, otherwise it has no content (null).  Similarly, you cannot control anything in the loaded swf until it has finished loading.  So assign an event listener to the contentLoaderInfo property of the Loader to determine when loading is complete, and have the event handler function deal with starting the interaction with it.
    var myLoader:Loader = new Loader();
    var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf");
    myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, processLoadedSWF);
    myLoader.load(url);
    function processLoadedSWF(evt:Event):void {
        // deal with the loaded swf here
        // but you don't want to be assigning it to the panel2 object that contains the loader
    As far as controlling anything inside the swf you load, is it an AS1/2 or an AS3 swf?

  • How can I access global variables in a loaded Applescript?

    How can I access global variables in a loaded script, in Xcode, ApplescriptObjC? Basically, I have a global variable defined in my parent script using "property", and I need to modify objects connected to those variables inside of a loaded script.
    Example:
    Parent script:
    script AppDelegate
    property myTextField : missing value
    //linked to a text field object
    tell myScript to myAwesomeHandler_()
    end script
    Loaded script:
    on myAwesomeHandler_()
    myTextField's setStringValue_("The new Xcode is so glitchy ugh")
    //changes value of linked text field of parent script
    end myAwesomeHandler_
    The problem is, the variable is undefined in the Loaded script, and I need it to have the same value as the parent script, and I don't want to pass the variable through the Handler. Any ideas?

    I think want you are looking to do will need to be done in two steps. Because myTextField needs to be a property for the ObjectiveC part of the code you cannot turn it into a global.
    However if you make a temporary variable global assign the string to it in the handler then set myTextField off of it.
    global myTextFieldGlobal
    script AppDelegate 
    property myTextField : missing value 
    //linked to a text field object 
    tell myScript to myAwesomeHandler_() 
    myTextField's setStringValue_(myTextFieldGlobal)
    end script 
    on myAwesomeHandler_() 
    set myTextFieldGlobal to "The new Xcode is so glitchy ugh"
    //changes value of linked text field of parent script 
    end myAwesomeHandler_ 
    I know you stated you did not want the handler to return a value but I have to ask why? Global's, imo, are not a good idea and really should be used as a last resort.
    One other possibility is to pass a reference to the property to the handler. Not sure if that works in AS of if that would satisfy our requirement of not passing the variable through the handler
    <edit>
    Another though have you tried to define the property outside the script?  That is
    property myTextField : missing value
    script AppDelegate
    Not sure if that will work.
    You might also want to have a look at Scope of Properties and Variables Declared in a Script Object

  • I have an iMac OS 10.9.5 - Every time I turn on my system I get the message that it can not access icloud and to fix it using iCloud preferences. I do not want to access or use iCloud, how do I get the message to discontinue?

    I have an iMac OS 10.9.5 - Every time I turn on my system I get the message that it can not access icloud and to fix it using iCloud preferences. I do not want to access or use iCloud, how do I get the message to discontinue?

    Hello mrmacjohn,
    Verifying that any iCloud account that may be signed in is signed out should resolve this error.
    On your Mac, open iCloud preferences, then click Sign Out.
    iCloud: Change iCloud feature settings
    http://support.apple.com/kb/PH2613
    Cheers,
    Allen

  • Getting quite frustrated with my iPhone 4S.  Can't access WIFI and/or Bluetooth nor will my computer allow it to be a "hotspot" unless physically tethered to computer.  It started acting up after download....it also has messed up some app

    I've only had this phone since Sept. and have already had to have the speaker replaced.  NOW I can't access wifi and/or bluetooth (both are grey).  I can't use the Personal Hotspot either (and the passcode no longer shows up).  I can only access internet via the phone through the USB.  This started over the past few days (and after I updated to IOS).
    Some of my apps no longer work either...over 100+ hours of audiobooks on Audible can't be accessed as the Audible app just shuts off.
    Any recommendations on how to recify?   I'm pretty rural so downloaded anything takes going to the next town over to get a signal from the library...  and all of my searching is eating into my 5gb limit through ATT....so it is a bit irritating

    called Apple Care this a.m....new upgrade on 12/31/12 is supposed to fix the "bug"

  • How can I access photos and videos saved to the iCloud?

    How can I access photos and videos saved to the iCloud? I backed up my iphone to the Cloud but now the files are nowhere to be found.
    I had to reset all content and settings in order to troubleshoot an issue. Before I did this, I backed up the iphone to icloud. When I reprogrammed the phone, I had to set it up as a new device and individually sync apps and other items from itunes. But by doing this, I somehow lost some videos and can't seem to find where they would have been saved/backed up. Can anyone offer any guidance?

    You can't view photos and videos on icloud (except for shared photo stream pics).  iCloud merely sync photos between devices using the stream.  If you don't have photo stream turned on, then the only place photos in the camera roll are located are in a backup.  You would have to restore from the backup.  But be warned that many users have ended up losing their photos when performing a restore, for whatever reason. 
    What you should do in the future is always sync photos/videos to a computer for storage, don't leave them on a device or trust icloud to somehow store them.

  • I would like to have a storage solution that is accessed wirelessly, can be accessed remotely and is viewable in the finder side bar (mavericks)

    I would like to have a storage solution that is accessed wirelessly, can be accessed remotely and is viewable in the finder side bar (mavericks)
    Is this possible? if so, how? Thanks in advance
    Ini

    You have to pay for online storage, someone has to pay to keep the lights on. As far a getting it on the Finder sidebar, you did something wrong. That is where mine resides, see below.

  • How do you work around code not functioning in loaded SWFs on iOS.

    Hi,
    I came across a post that suggested that in iOS, code does not function in loaded SWFs and a quick test demonstarted that this was true.  I'm just wondering if anyone has come up with a workaround for this.
    I'd appreciate any insight you can give me.
    Best,
    Chris

    Chris,
    The reason external SWFs with code in the doesn't work is that ADT cross-compiles your root SWF (and only your root swf) into objective-c code consumable by an iOS device.
    I created a workaround for this problem - as long as you embed your asset like this:
        [Embed(source="gameLevel.swf")]
          private var gameLevel:Class;
        addChild(new gameLevel());
    In this scenario, if gameLevel.swf has code in it, it typically wouldn't work in iOS, because new gameLevel() would create a Loader and interpret SWF bytecode.  But, if you first run the above SWF through my tool called SWFMerge, it will take your embedded SWF and merge it into your root SWF.  The result is that ADT will compile your code into objective-C, it will work on iOS, and note: new gameLevel() now results in an instance of your asset - NOT a Loader.
    The SWFMerge tool is here:
    http://www.onetacoshort.com/temp/SWFMerge_alpha.swf
    LMK if this workaround works for you or if you have trouble.  Cheers!
    -Jeff

  • After installing Yosemite upgrade, can't access documents and files

    I installed the Yosemite upgrade without making a proper backup first, not realizing what a major upgrade this is. During the install, I was prompted to create a new user account. Now that the upgrade is complete, when signed in as the new user, I can see my files and documents listed in a Device called “Guest’s MacBook Pro,” but when I try to access them, I’m told I don’t have permission to see the folders' contents.
    I should add that I bought this machine used, and I have always used it under the name “Guest.”
    Please help me access my stuff! Thanks in advance.
    EtreCheck version: 2.2 (132)
    Report generated 5/2/15, 11:47 AM
    Download EtreCheck from http://etresoft.com/etrecheck
    Click the [Click for support] links for help with non-Apple products.
    Click the [Click for details] links for more information about that line.
    Hardware Information: ℹ️
        MacBook Pro (13-inch, Mid 2012) (Technical Specifications)
        MacBook Pro - model: MacBookPro9,2
        1 2.5 GHz Intel Core i5 CPU: 2-core
        4 GB RAM Upgradeable
            BANK 0/DIMM0
                2 GB DDR3 1600 MHz ok
            BANK 1/DIMM0
                2 GB DDR3 1600 MHz ok
        Bluetooth: Good - Handoff/Airdrop2 supported
        Wireless:  en1: 802.11 a/b/g/n
        Battery: Health = Normal - Cycle count = 140 - SN = 9G2150ZCUD3MB
    Video Information: ℹ️
        Intel HD Graphics 4000
            Color LCD 1280 x 800
    System Software: ℹ️
        OS X 10.10.3 (14D136) - Time since boot: one day 0:3:24
    Disk Information: ℹ️
        APPLE HDD HTS547550A9E384 disk0 : (500.11 GB)
            EFI (disk0s1) <not mounted> : 210 MB
            Recovery HD (disk0s3) <not mounted>  [Recovery]: 650 MB
            Macintosh HD (disk1) / : 498.88 GB (429.05 GB free)
                Encrypted AES-XTS Unlocked
                Core Storage: disk0s2 499.25 GB Online
        HL-DT-ST DVDRW  GS31N 
    USB Information: ℹ️
        Apple Inc. FaceTime HD Camera (Built-in)
        Apple Inc. iPhone
        Apple Inc. BRCM20702 Hub
            Apple Inc. Bluetooth USB Host Controller
        Apple Inc. Apple Internal Keyboard / Trackpad
        Apple Computer, Inc. IR Receiver
    Thunderbolt Information: ℹ️
        Apple Inc. thunderbolt_bus
    Gatekeeper: ℹ️
        Mac App Store and identified developers
    Kernel Extensions: ℹ️
            /Library/Application Support/MacKeeper/AntiVirus.app
        [not loaded]    net.kromtech.kext.AVKauth (2.3.7 - SDK 10.9) [Click for support]
        [not loaded]    net.kromtech.kext.Firewall (2.3.7 - SDK 10.9) [Click for support]
    Problem System Launch Agents: ℹ️
        [killed]    com.apple.CallHistoryPluginHelper.plist
        [killed]    com.apple.cmfsyncagent.plist
        [killed]    com.apple.coreservices.appleid.authentication.plist
        [killed]    com.apple.icloud.fmfd.plist
        [killed]    com.apple.SafariNotificationAgent.plist
        5 processes killed due to memory pressure
    Problem System Launch Daemons: ℹ️
        [killed]    com.apple.AssetCacheLocatorService.plist
        [killed]    com.apple.awdd.plist
        [killed]    com.apple.corestorage.corestoragehelperd.plist
        [killed]    com.apple.ctkd.plist
        [killed]    com.apple.findmymac.plist
        [killed]    com.apple.icloud.findmydeviced.plist
        [killed]    com.apple.installd.plist
        [failed]    com.apple.mtrecorder.plist
        [killed]    com.apple.nehelper.plist
        [killed]    com.apple.nsurlsessiond.plist
        [killed]    com.apple.softwareupdate_download_service.plist
        [killed]    com.apple.wdhelper.plist
        11 processes killed due to memory pressure
    Launch Daemons: ℹ️
        [loaded]    com.adobe.fpsaud.plist [Click for support]
        [failed]    com.apple.spirecorder.plist
        [running]    com.mackeeper.AntiVirus.plist [Click for support]
        [loaded]    com.microsoft.office.licensing.helper.plist [Click for support]
        [running]    com.zeobit.MacKeeper.plugin.AntiTheft.daemon.plist [Click for support]
    User Launch Agents: ℹ️
        [loaded]    com.google.keystone.agent.plist [Click for support]
    User Login Items: ℹ️
        Google Chrome    Application Hidden (/Applications/Google Chrome.app)
    Internet Plug-ins: ℹ️
        FlashPlayer-10.6: Version: 17.0.0.169 - SDK 10.6 [Click for support]
        QuickTime Plugin: Version: 7.7.3
        Flash Player: Version: 17.0.0.169 - SDK 10.6 [Click for support]
        Default Browser: Version: 600 - SDK 10.10
        SharePointBrowserPlugin: Version: 14.4.9 - SDK 10.6 [Click for support]
        Silverlight: Version: 5.1.30514.0 - SDK 10.6 [Click for support]
        JavaAppletPlugin: Version: 15.0.0 - SDK 10.10 Check version
    3rd Party Preference Panes: ℹ️
        Flash Player  [Click for support]
    Time Machine: ℹ️
        Time Machine not configured!
    Top Processes by CPU: ℹ️
             5%    hidd
             5%    WindowServer
             3%    ClanLord
             1%    Google Chrome Helper(12)
             1%    fontd
    Top Processes by Memory: ℹ️
        1.20 GB    Google Chrome Helper(12)
        488 MB    kernel_task
        164 MB    Google Chrome
        147 MB    ClanLord
        78 MB    mdworker(7)
    Virtual Memory Information: ℹ️
        47 MB    Free RAM
        3.95 GB    Used RAM
        140 MB    Swap Used
    Diagnostics Information: ℹ️
        May 1, 2015, 11:43:03 AM    Self test - passed

    MacKeeper – Do Not Install
    MacKeeper – Do Not Install (2)        See  SDW2001’s post
    MacKeeper Removal
    MacKeeper Removal

  • Can't access EWS and front printer panel options all locked

    The web services icon and Network icons are disabled. All the options on the front panel to connect to the network are locked so I can't do anything from the printer panel.
    I printed the Network configuration and obtained the ip address but the EWS does not come up. It says it can't connect.
    I tried the ip address that i previously used to connect with and that won't come up either.
    How do i get the printer connected to the Network again? HELP!

    Thanks for the response.
    I tried unplugging the plug but that did not reset the printer.
    I found another post that explained how to access a hidden Suppot menu.
    I was able to find the option that performs a partial reset and that restored all the functionality
    to connect to the network.
    The printer is on the network and I can now access the EWS. I also modified the admin settings
    to not lock the printer panel again!

  • Can't access Keyboard and Mouse panel of System Preferences

    I can't access the Keyboard and Mouse panel of System Preferences. System Preferences starts up fine but when I click to access the Keyboard and Mouse panel, System Preferences indicates in the title bar of the window that it is loading the panel but it never does.
    Does anyone have an idea about how to fix this? Thank you.
    Brian

    Hello Brian:
    I would trash the preference file (com.apple.systempreferences.plist) and then restart the computer.
    Barry

  • DW CC Template- can not access hide div function

    Hi,
    I created saved my page as a template and created a new page from the template. In the areas marked editable I can no longer access the button to "hide" a fluid grid div. I can pull up the "hide" function in the footer that is NOT in an editable region. This doesn't make any sense. Am I doing something wrong?
    Thanks
    Andrea

    Suggestion would be the same as in thread http://forums.adobe.com/message/5517243#5517243

  • Why can I access Internet, and get my email through yahoo, but can't access email when I use the mail icon on the front of my tablet. It just started doing this today.

    Why can I access the Internet, even get my email by going through yahoo, but as of this morning I can not access my email from the mail icon on my tablet screen. It just started doing this today. When I try to get my email by going through the icon, I am asked to enter yahoo password. I do this, then the box just pops up again, and again and again never letting me get signed in. Don't know what I am doing wrong. Need help!

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
     Cheers, Tom

  • My wife has a separate User Login. How can she access photos and documents on my User Account?

    What do I need to do under my wife's user login so she can have access to photos and documents on my user account?

    Move the data you want to share to the hard drive level Users/Shared folder and she will be able to access them. You may have to do a Get Info (command - I) on the folder and add her with read/write permissions, then select the gear at the bottom and Apply to enclosed items.

Maybe you are looking for

  • Embedded fonts not working

    embedded fonts aren't working for me in TextFlow. The non-embedded/pre-included fonts are working fine but if i try to add my own font, it doesn't work. i have the font set to DF4 and i have it exported for ActionScript with a class name. the font i'

  • SAP PP: In BOM how to where to maintain the details like Length, Width and Quantity

    Dear All, In SAP PP where to maintain the details like Length, Width, Quantity of the material for production information. Eg: Client will procure a material of 10milli meter Thickness Mild Steel material of fixed dimensions lets say 4meters x 4Meter

  • Oracle 10g Express Service not starting Database

    I have a fresh download and install or Oracle 10gExpress and am having issues when I manually start the OracleXE service. The OracleXE Service starts, but the database does not. The error I see is ora-12560. The database and service stops correctly i

  • Maverick will not wake up from sleep

    Maverick will not wake up from sleep. i dont see any related issues. maybe i am the only one? Ive been trying to run maverick for the last 2 months. I thought everything was fine after I erased, reformated and partitioned the HD and installed Maveric

  • Role Expert Profile generation error

    Hi All, I am getting the following error in Role Expert Profile Generation tab. When i click Generate tab, I am geting "Name or Password is incorrect(Repeat Login)" Can any body explain what user id is generally triggered when generate profile using