Actionscript 3.0 :: Access Child Swf Document Class Using ApplicationDomain
Jun 22, 2009
i m getting an error, i am loading an external child swf file to main parent swf, and want to access the document class of the child swf through parent swf document class using application domain. Now when both child and parent swf resides in same directory it's works properly with application domain means we can access the document class of the child swf see the attachment samedirectory.zip and when we move child swf and it's document class to sub directory that time we are unable to access the document class of the child swf see the second attachment subdirectory.zip
View 1 Replies
Similar Posts:
Jan 17, 2010
i m getting an error, i m new to as3, actually i am loading an external child swf file to main parent swf, and want to access the document class of the child swf through parent swf document class using application domain. Now when both child and parent swf resides in same directory it's works properly with application domain means we can access the document class of the child swf see the attachment samedirectory.zip and when we move child swf and it's document class to sub directory that time we are unable to access the document class of the child swf see the second attachment subdirectory.zip and give me right direction
View 2 Replies
Jul 14, 2010
I know I can use ApplicationDomain to access child class.Strictly, likewise, can I done it without adding child swf to stage?
View 1 Replies
Apr 14, 2011
I am new to AS 3 and I tried to solve this (probably really simple) problem, but I couldn't, so I gotta ask here. All I did was create a child through a function in my document class.It is in fact an altered version of the rotate circles tutorial from kirupa.
Code:
function makeCircle (e:Event):void {
var circle:BlueCircle=new BlueCircle ;
[code]......
View 4 Replies
Jul 22, 2010
i know this may seem kind of dumb, but how does one access the document class from a child movie clip on the stage?
i have a property in my class. Just a string for testing:
Code:
public var s:String = 'can you see me';
it traces on the root time line, but it errors out if tracing it from a movieclip on the root time line.
View 1 Replies
Mar 7, 2012
How to access a display object on the stage in a class which is not a document class?
I am looking for a solution that doesn't involve passing the stage as a parameter to the class.
One solution i always come across is using "TopLevel.as". Is it a good method because as far as I have heard using global variables is not recommended because it might cause some problems while working on big projects.
View 1 Replies
Mar 3, 2011
Going further on my app, I felt in another problem. Despite having lots of posts on the web regarding this, none of the solutions worked for me In my document class (Main.as) ve two containers. One empty and another with a star that is being imported from the library. Here´s the main class:
package
{
import flash.display.*;
[code]......
View 4 Replies
Nov 24, 2011
The name of my DocumentClass is Main. So, what's the difference between :
var myClass:Main = new Main();
var mcInLibrary:MovieClip ;
/////////////////////////////////////////[code]............
View 1 Replies
Apr 13, 2010
I have a document class with a child MovieClip on the stage. I have the clip already on the stage because it's part of an complex layout provided by the designer and it seems easier to leave it on the stage than to use addChild (since I would have to add about 60 objects).What is the best way to reference the document class from inside the child MovieClip class?
View 1 Replies
Jan 19, 2011
I have a class linked with a movie clip, and in this movie clip I want to be able to add an event listener that calls a function in the Document class (the class you link with the fla as a whole). How can I do that? Say the name of my document class is KPScript.as. In my GameController.as class, I want to listen for key input and call pageChange() in KPScript.as when it gets called. Would I have to import KPScript.as into the GameController.as? If so, I wouldn't want to create another instance of the KPScript object.
View 1 Replies
Feb 12, 2011
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:
Parent SWF - document class, MovieClip(root)
|
Child SWF (loaded by parent) - document class, MovieClip(root)
View 2 Replies
Jul 22, 2009
here is the scenario we ran across while working on our Flash AS3 project today.
/main/root.fla
/main/root.as
/main/sub1/sub.fla
[code]....
We have many sub swf's that are loaded by the main root swf. The root swf shows the art on the stage of the sub swf, and also runs some code from the sub swf's document class. However, we noticed the constructor was not getting called on the second sub swf if the document class is the same name- even if they are in different folders. Note that we publish our swf files to a separate directory (with the same structure as above) so it is easily copied to the web server.
-root.swf loads sub1/sub.swf
-the constructor of the document class sub.as in subfolder sub1 gets called
-root.swf shows sub1/sub.swf assets with the correctly constructed sub1/sub.as document class
-user chooses to switch to sub2
[code]...
We decided to use a workaround where we basically changed the two document class .as files to be different names (e.g. renamed sub1/sub.as -> sub1/sub1.as and sub2/sub.as -> sub2/sub2.as, and updated the .fla's to point to the renamed document classes), and it works as expected. Hopefully that workaround is useful for someone.I realize most people just name every single file differently and keep everything in one folder, but when you have a sufficiently complicated project, things like this come up.
View 2 Replies
Jan 27, 2010
Got two classes "Engine.as" and "Player.as". Engine.as is the document class that is calling Player.as.
The point is to have Player.as create a movieclip on the stage, but it seems it cannot access the library or something. Because when the player class is at the createHero() method it gives me the "error 1009 cannot access a property or method of a null object reference"
Engine class:
Code:
package test{
import flash.display.*;
import flash.events.*;
[Code]....
View 2 Replies
Oct 3, 2011
It seems simple, but it doesn't seem to be working I have 2 as3 files as classes "mainclass.as3 (this is the document class)" and GamePlay.as3
the GamePlay class works flawlessly on it's own, but when i try to create the var to access it ... var gp:GamePlay=new GamePlay(); ... i get the following error.
I have looked at tutorial etc, but i cant get it to work i am currently getting the following error.[code]...
View 1 Replies
Sep 21, 2010
It used to be simple to access an object you put on the stage like a mc or dynamic text field by simply using _root.instanceName ect. Now I see references to making references to the Stage and such like:
private var stage:Stage;
stage = stageRef;
and I am still confused.
What I have going on is, I have placed a movieclip on the stage in Flash and gave it an instance name of Cell_mc.I have a cusom class that extends MovieClip with the following imports
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.EventDispatcher;
[code]....
This Class is tied to a set of MovieClips in my Library.
I have a listener: this.addEventListener(MouseEvent.MOUSE_DOWN,pickUp);
And a function:
private function pickUp(event:MouseEvent):void
{
this.startDrag();
[code]....
I get the following error whenever I try to access an object I placed on the stage from anywhere other than the document class:
1120: Access of undefined property Cell_mc.
How do I access the cell_mc that is already on the stage from this non-document class?
View 5 Replies
Sep 30, 2009
if i want from a document class to access some variables in other classes (which are imported into that document class) does these variables need to be public to access them or they can be something else?
View 9 Replies
Nov 14, 2010
How do I access the timeline from the document class? I tried: trace(this.parent as MovieClip)
but I got a null object.
View 9 Replies
Jan 30, 2009
I was wondering if it was possible to access the document class from within a movieclip.
I am creating a slideshow type project, and I'm using a document class to switch between the frames using the arrow keys. However, in one of the "slideshow screen" movieclips, I want to have it stop, and then play another part when the arrow key is pressed again.
I tried to access my nextScreenToPlay method within the document class, but whenever I try to do it within a movie clip, I get this error: Call to a possibly undefined method nextScreenToPlay through a reference with static type class.
If I do a trace(Main), within a movieclip, it shows the class.
View 1 Replies
Sep 18, 2009
trace(MovieClip(root).TRACE);
so at pesent I am using this to try and access
Code:
public var TRACE:String
in the the document class.
however I am getting this
"1180: Call to a possibly undefined method addFrameScript.�"
my document class extends to Sprite as I have some stage resizing that occurs on Initialise
Code:
StaticInheritance extends Sprite
Im sure it has something to do with the way the document class extends.
View 1 Replies
Jun 15, 2010
I tend to give my Document class all public access modifiers. Would there be any reasons not to do this?
View 3 Replies
Aug 30, 2010
Just tried using cs5 on my new macbook and I have a tlf text object on the stage with an instance name of mText. I tried to access (mText.text = "test") it like this and got a null object reference. I tried to trace the stage from my document class and it was null when the tlftextbox was on the stage but i could trace stage correctly when I deleted the textbox. [code]...
View 2 Replies
Jul 29, 2009
How to access a public method in the swf loaded in a new ApplicationDomain?
ActionScript Code:
var appDomainA:ApplicationDomain = new ApplicationDomain();
*
var contextA:LoaderContext = new LoaderContext(false, appDomainA);
var loaderA:Loader = new Loader();
loaderA.load(new URLRequest("application2.swf"), contextA)
I want to access a public method in application2.swf from the main swf that loaded it.
View 8 Replies
Apr 19, 2009
For the example, there's a single FLA with a document class "main.as." In the public class main.as package, there is a public variable: "var example:String='example';." Inside of the FLA, there is one movie clip in the library and it is assigned a custom base class "sub.as." The movie clip is then placed on the first frame of the stage so its constructor is run at runtime and reads the value of example.
What is the proper way to get the value of "example" in the root document class? Using "root.example" in the sub.as class to target the document class returns an error and when I trace "root", I get "null." Main.example naturally throws an error because that's looking at the actual class and not the movie / stage its attached to.The round-about way I've done it before is to dynamically add the object in the library and pass in the root path when I create a new instance of it (example: submc:sub = new sub(this); ).Is there anyway to get back to the document class with a built-in method like root, etc?
View 2 Replies
Nov 20, 2010
I can access the targetObj instance inside the document class, but when I try to access it in another .as class,get this error:
Access of undefined property targetObj.
View 9 Replies
Jan 28, 2011
I m trying to access stage.width property but sometimes it trace 650 and 720 but i see my flash file dimension is 500x400, I need to align objects on stage..
View 1 Replies
Oct 17, 2011
I want to know how you access a variable within the fla file from the Document class?I want an int inside the fla or swf file to be accessed from the class that is being used to run the file?
View 5 Replies
Jan 7, 2010
I have a "box_mc" movieclip on the root of my stage and I need to select it from within my Document Class. I thought Stage.getChildByName("box_mc") would work, but it just returns null.
View 2 Replies
Nov 20, 2010
I can access the targetObj instance inside the document class, but when I try to access it in another .as class,get this error:
Access of undefined property targetObj.
View 2 Replies
Jun 23, 2011
I am trying to add a keyboard event listener to the stage, to detect when a user clicks the left or right arrow keys. But this listener is called from inside a class file which is imported into the document class, therefore I think it doesn't know what "stage" refers to. How do I solve this?
[Code]...
View 2 Replies
Aug 27, 2008
Let's say I have a FLA file with document class called main. In main, let's say I have a method called test1 that just outputs "hello world" via trace. On the FLA I have a movie clip. In that movie clip, when the timeline reaches frame 123, I want it to invoke the test1 method (I just set up a simple action on the frame). However, I get an error saying that the method is undefined. I try this.parent.test1() too but that gives me the same error. Is it not possible to invoke a document class property from within the timeline of a movie clip that's on the stage?
View 2 Replies