ActionScript 3.0 :: Using Root Property When Swf's Are Loaded In Other Swf's
Mar 25, 2011
Ive a quick question on using root property when swf's are loaded in other swf's. Is it safe/wise to reference MovieClip(this.root) in packages/classes if the swf will be loaded and placed inside another swf? I read once that root will always refer to maintimeline, and all objects have the same root. So...will the root change in some way if a preloader loads the main swf?
I have a root stage, and a MC that is called from the root stage.Now from that MC, i will called in another MC2, and I wanted to placed the MC in the center of the stage. The reason I could not use normal ADDED_TO_STAGE at MC and define the center is because MC is not place in the exact position of the root stage (as in x, y=0). So if I would target MC2 at MC stage center, it would not be the exact center of the root stage/screen.How can I called the root stage properties rather than adding MC2 into the stage?
So when you have a Document class, it is added as an object to the stage. If the equivalent of stage.getChildAt(0); is traced in any custom class linked to the Document class it will output the Document class (ex: GalleryDocument). If you trace it's name property like so stage.getChildAt(0).name; it will output root1.
Is it possible to assign a different name to the Document class or is there a limitation on changing the name property when it comes to the root object?
I created a new slideshow in flash CS3 - AS3 but my code that I had for xml caching is barking at me and I am not sure what to do. The output window shows access to undefined property root.
I have this error when running my application on debug mode :
ReferenceError: Error #1056: Cannot create property root on MyClass.
The problem is that MyClass doesn't contain any root property and i don't know how it get it, I have isRoot property at the Java Class with setRoot setter and isRoot methods,
at the flex side i have isRoot as public without getter and setter.... could the problem be just convention names compatibility
I have a MainClass from where I can call Stage. In the MainClass I call another class named Subclass, and in that one I call my ThirdClass. ThirdClass is initialized fine, but my problem appears when I want to call the Stage within the ThirdClass, to align the Stage. When I compile I receive the message: 1119: Access of possibly undefined property align through a reference with static type Class.
I am migrating to AS 3.0 from AS 2.0 and I am unable to access the root of the main swf from the loaded swf. In AS 2.0 i simply used "_root.gotoAndPlay(frame number); I have also tried Movieclip(this.root).gotoAndPlay(frame number); but it doesn't work.
I have a swf called anim1.swf acting as a preloder and loading anim2.swf. anim1.swf is attached to a document class called Racine.as. Once anim2.swf is loaded, how can I target the root of anim2.swf?
For example, anim2.swf contains 2 clips called clip1 and clip2. clip1 contains a child called clip1_1. How can I access clip2 from within clip1_1 by using an absolute way (I don't want to use the parent property)?
N.B : a way would be to have a document class attached to anim2.swf, but here there is none.
I have a SWf application built in flex 4. One part of the application relies on accessing a public variable ("step1") set at the application root, and is accessed with
var app:Object = FlexGlobals.topLevelApplication; trace("step one is "+app.step1);
This, while not optimal, has worked fine. Now, hoever, I need to load this entire application into another application, and I can't figure out how to access my step1 variable any longer.I have been loading the swf into the new parent application like so:
public var myLoader:Loader = new Loader(); public var pizzaContainer:UIComponent = new UIComponent(); private var myUrl:URLRequest = new URLRequest("chickensoup.swf");
I was checking my policyfiles log file and noticed that I have the following for a newly created (and played in Firefox) SWF file I made:OK: Root-level SWF loaded:URL...I was trying to find some documentation in livedocs.adobe.com but couldn't find anything...
I am migrating to AS 3.0 from AS 2.0 and I am unable to access the root of the main swf from the loaded swf.In AS 2.0 i simply used "_root.gotoAndPlay(frame number);I have also tried Movieclip(this.root).gotoAndPlay(frame number); but it doesn't work.
i have a class .as file which extends MovieClip. inside the .as file there is a public function and when called upon it needs to change the value of a property that is on the maintimeline
Code: package { import flash.display.*[code]....
problem is this error 1119: Access of possibly undefined property gear_num through a reference with static type flash.displayisplayObjectContainer.
I am forced to develop in AS2 for Flash Player 6 with dial-up speeds in mind (client imposed limitations - dark scary limitations *shudders*).The client requires a swf to load into a flash application dynamically.I am worried about this 'cos there are a number of _root objects, movieclips, initiated classes and variables at the _root level.I don't want the client to be able to load in the external swf with code referencing the _root that could potentially interfere with my _root items (potentially exploding my universe!).Is there a way to change the scope of _root and _level0 for the target mc the swf is loaded into?Can I simply disable _root and _level0 for this clip?I would prefer a non-class method to achieve this if possible as I am loading all class scripts at frame 2 and all shared library elements, xml and the offending swf in frame 1 - all for accurate preloading purposes (that whole dial-up thing again ....)
I'm loading a lightbox as an image gallery, but I'm working on changing it to full flash. My site is structured with external swfs. I ran into a barrier, because I'll need to load the images (and reference the stage size) in the root timeline, but I don't know how. MovieClip(root) only references the smaller loaded swf's main timeline.
How can I access variables defined on root from a loaded movieclip? The loaded movieclip path can differ, so I cannot get to root like parent.parent, for example. I thought something like this.root.varName may work, but it obviously doesn't.
Does anyone know the best method to trigger a function in the root from a dynamically loaded movieclip (loaded using addchild) using AS3, I understand targeting root is not the best way to do this?
I'm using a PreLoader as a parent SWF that loads the actual website as a child SWF. In the website SWF, the child SWF, will MovieClip(root) still work and refer to it's own root, or the PreLoader's root? And would I still access the websitite's document class (the child's document class), through MovieClip(root)? What if both files have a document class?So my main question is how do document classes and MovieClip(root) behave in the scenario when you have:
Im having whta I think is a quite common problem. I recently started migrating form AS2 to AS3 and Im buidling a home made template for all AS3 projects..
I have just loaded portfolio.swf on top of main.sfw. The buttons on portfolio.swf share the same class as the buttons on main.swf
I have small issue in as3. I am load "mainmenu.swf" file into "main.swf". through loader class. so now "main.swf" is parent "mainmenu.swf" file children how can call "main.swf " variable & function from "mainmenu.swf" .
I'm extending / modifying this tutorial to create a runtime asset loader class. Kinda got it working, but in efforts to streamline it, ran into this issue: - doc class for external library swf: ActionScript Code: package com.b99.runtimeLib { import com.b99.utils.IRuntimeLibrary; import flash.display.MovieClip; [Code] ..... In this case, ASSET_DEF is returning undefined, and isn't showing up as a property during debug. How to expose this property to the loading class?
I am getting the following error when I importmy swf onto my main stage: TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FtScrollBar/set useMouseWheel() at ButtonsMenu_fla::buttonsScrollingMenu_1/ButtonsMenu_fla::__setProp_sb1_buttonsScrollingMen u_ScrollBarComponent_1() at ButtonsMenu_fla::buttonsScrollingMenu_1$iinit()[code].....
On it's own the carousel works fine, it's only when I import it that it throws an error, all of the components within the carousel work fine (the images are highlighted on mouse over, the onclick code for the thumbs runs the right functions) it's just the scrolling that doesn't work.I've tried removing the references to stage from the loaded swf but I still get the same errors.I'm fairly new to flash but I'm finding the error messages to be fairly unhelpful at the best of times, I've attached the swf I'm trying to load in in a zip
i have one main.fla, its document class is main.as. the code in main.as is package.[code]where val is the property of Loading class.so how can i access.
Does anyone know of a workaround for loading an AS3 swf into an existing AIR/Flex (Flex 3) application and having the loaded SWF retain its own reference to its stage (not the loader's stage)?
I've tried the loadForCompatibility property on SWFLoader, but that isn't giving me the behavior I'm wanting. The loaded swf still has the main AIR app's stage set.
I try access to (MySWF(movieClip)).id but I get a weird message error: 1120: Access of undefined property aslider Which is defined in MySWF.init. If I remove (MySWF(movieClip)).id program works perfect! Isn't this weird especially as I have added addEventListener(Event.ADDED_TO_STAGE, init); in MySWF constructor to ensure that aslider is on the stage.
In main: private var idMySWF:int; public function loadMySWF(event:MouseEvent) { idMySWF = 1; var myLoader:Loader = new Loader(); myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete); [Code] .....
A have a external SWF file that contains an instance of an object that will be used across multiple projects. It's accessible as a public property of the external SWF.When I load the external SWF file using the Loader class everything comes in fine but when I try to assign the value of that property, which traces out as an instance of the correct object, to a local variable the local variable is always null.Below is a dumbed down sample of what I'm trying to accomplish:# Object Class