Accessing A Stage Instance From A Class Other The Document?

Dec 19, 2010

I have a main document class with another class instanciated (mouse follower.as) within it. I want the mouse follower class to access a stage instance. How is this done?

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Accessing Instance Of Document Class

Jun 5, 2009

I have a really peculiar problem that relates to the old question of how to best access the instance of the document class from a different class. I usually add a 'this' as parameter when I create an instance of another class inside the document class. Then I save this 'this' in a class property of the type 'Object'. It usually works just fine but lately I have encountered a really bizzarr error.

When my movie first starts I have to load 2 xml-Files. I do that in another class - that calls upon the document class instance when it is finished. I use 4 methods for that, each calling the other, when it is finished.
(like one doing loader.load(urlRequest),
then loader.addEventListener
(Event.Complete, nexthandler) and so on

Now, when I call back to my document class from the last of these 4 methods it works just fine. But when I try skipping the first two methods (since I now need only one xml-File) - my try/catch-statement suddenly complains: TypeError: Error #1010! Like it needed more time to establish the instance of the document class or something similar strange.

View 4 Replies

ActionScript 3.0 :: Accessing The Stage From A Class Which Isn't The Document Class?

Jul 3, 2009

I'm being really dumb today and I know this should be simple.....How do i access the stage from a class which isn't the Document Class? For instance, I want to create a tween which takes in the parameters of the stage's width? So I've written.....

ActionScript Code:
var myTweenX:Tween = new Tween(this, "x", Regular.easeOut, this.x, stage.stageWidth, 60, true);

[code].....

View 4 Replies

ActionScript 3.0 :: Accessing Stage From Function In Document Class

Dec 10, 2010

How do you access the stage from a function in a document class file? I tried a fairly simple:
ActionScript Code:
var main:MovieClip = new MovieClip();
addChild(main)
var _stage:Stage = main.stage;
trace(_stage);
The result was null.

View 5 Replies

ActionScript 3.0 :: Accessing Stage Property From Document Class

Jun 11, 2010

I have a document class that is connected to a swf but for some reason I can't access the stage/root property. I can access all instance names that are on stage but trying to access stage will return "null". What's up?

View 5 Replies

Accessing Stage From A Class Which Isn't The Document Class?

Jul 3, 2009

How do i access the stage from a class which isn't the Document Class? For instance, I want to create a tween which takes in the parameters of the stage's width?[code]

View 8 Replies

ActionScript 3.0 :: Accessing An Instance On Stage From Within Another Class?

Jun 14, 2007

access one instance of a MovieClip on the stage (blue_mc) from within the class file of another MovieClip (red_mc).e.g. One instance of "Blue" on the stage called "blue_mc", and one instance of "Red" on the stage called "red_mc". Both symbols are linked to class files (Blue.as and Red.as).In Red.as, I set up a function to listen for a mouse down event. When this is triggered, I want to move the instance blue_mc. At the moment, though, I can't seem to get a reference to blue_mc.I've looked into the new stage and root properties, but even though blue_mc is on the stage, it cannot be accessed using stage.getChildByName( "blue_mc" ) either.

Code for Red.as:

Code:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;

[code]....

View 6 Replies

Access An Instance Reference To Document Class From Stage's Timeline?

Dec 30, 2009

Is there a way to get an instance reference to the document class to call a method of it from the stage's timeline?I see that here's a possible solution: using a singletonOther solution I though of is using stage.getChildAt( 0 ) but it's not very nice.Is there an 'official' instance reference? because the document class is obviously instantiated at startup, but is that instance accessible in any way without having to use a custom solution like the ones mentioned?

View 1 Replies

Actionscript 3 :: Manipulate With Symbol On Stage From Document Class Without Creating New Instance?

Sep 18, 2011

So I have one movie clip on stage rect_mc and document class Main.as I can import movie clip to document class with [code]...

but is there any way to manipulate rect_mc without craating new instance and attaching it to a stage with addChild()

View 2 Replies

ActionScript 3.0 :: Accessing Variable In Document Class From Within Another Class?

Mar 11, 2009

I have an array in my doc class that I'd like to access from an external class. Can you do this and if so what's the syntax?

View 6 Replies

ActionScript 3.0 :: Accessing A Class Property Through Document Class?

Sep 3, 2009

I have a document class that looks like this:

Code:
package
{
import Map;

[Code]....

Is it possible to access a property of the Map class (though map defined in the Document class) from within the hero class?

View 4 Replies

ActionScript 3.0 :: Accessing Document Class Property From Another Class

Feb 28, 2010

The Main.as file will have all of the game logic, such as the mysteryNumber.

The other actionScript files represent rooms that the user may click and depending on the 'mysteryNumber', it will execute the 1 of 6 scenarios.

So for example, if a user clicks the Library page, the LibPage.as will call the 'mysteryNumber' and execute some code to display on the library page.

It will be the same for the other 4 rooms.

The problem I have is that the LibPage.as won't call the 'theNumber' property from Main.as

Here's the Main.as

Code:
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;

[Code]....

View 3 Replies

ActionScript 3.0 :: Accessing MC Class From Document Class?

May 25, 2010

I have created a movieclip in the library and added a class to it. I want to access a function and set an Array in that class from the document class...Heres what im doing now which is not working... it says startnow function is undefined.

PHP Code:
package comimport flash.display.*; import flash.events.*; import com.NavMC public class Capability extends MovieClip Constants: //

[code].....

View 5 Replies

ActionScript 3.0 :: Document Class Vs Manual Instance Of The Same Class?

Apr 6, 2010

I mean a have a class called Login and when I make an instance of this class

PHP Code: var log:Login = new Login(); 

doesn't give me the wanted results.

- When it is declared Document class it adds a child on stage

- When the same class is called manually (via the above code) although I get no errors nothing is added on stage.

View 3 Replies

ActionScript 3.0 :: Accessing Properties Of The Document Class?

Nov 14, 2009

when I try to access a property of the document class from another class, I get an error:

Quote:

1119: Access of possibly undefined property _left through a reference with static type flash.displayisplayObject.

Maybe I'm not doing it correctly? This is how I've been accessing document class properties so far. Does the fact that they're private make a difference?

Quote:

root.property

View 1 Replies

ActionScript 3.0 :: Document Class, And Accessing Properties?

May 25, 2009

I'm currently working on an interactive app, (site) which requires me to modify a few textfields, and change images dependant on the user choice (using mouseevent). This is a separate module, thus I'm posting the question in here instead:there are three images, that are lined up, with a textbox next to them. When a image is chosen, and enlarges, the text changes with the chosen image, according to XML.The textFields, 'text_title', 'text_description' are contained in a movieclip, called 'textbox'.This has been built in the Flash IDE (CS3) named info.fla/swf, which refers to a Document class 'com.info', made in Flex Builder 3...I attempted to modify the textfields using this:textbox.txt_title.text = "Loading";textbox.txt_desc.text = "test";But, I was unable to at first to change the text using the document class, as it gives "1120: Access of undefined property <variable>".

View 3 Replies

ActionScript 3.0 :: Accessing Function In The Document Class?

Nov 24, 2009

I have an instructions.as file which is trying to call a function in the document class through a mouse click event listener and am getting a 1009 error.

Here are my to actionscript files:

** this the the instructions.as**
package Elements{
import flash.display.MovieClip;
import flash.events.*;

[Code].....

View 3 Replies

ActionScript 3.0 :: Accessing A Function Of The Document Class?

Mar 29, 2011

My project is structured as following :

- a fla file with movieClips on the timeline , this fla is linked to the Main class

- a Main class who does some randomization of the animations

- a MenuItem class which function is to give each button menu the same functionnality

the problem is that I'm trying to access to the randomNumber function inside the Main class from the MenuItem class to prevent the rewriting of the function inside this class. I've made some research on Google and apparently I have to create a Singleton class so I can access the Main class from everywhere, I've followed those instructions but it still doesn't work, when I trace the Main class from the MenuItem class it gives me a Null result!Main Class code :

Code:
package
{
import flash.events.Event;[code].....

View 4 Replies

ActionScript 3.0 :: Document Class Instance Available To Sub Class?

Oct 7, 2010

I'm creating a Papervision3D scene in a document class. I have added an instance of a PointLight3D object. I'd like to create a class that uses the light instance in the main document class for its material. What would the Actionscript be to do this? I can't refer to the light as super.light because my class is inheriting the Sphere class. parent.light does not work either (even if I wait for the class to be added to the stage).

View 2 Replies

ActionScript 3.0 :: Accessing A MovieClip From An External As That Is Not The Document Class?

May 9, 2009

Instead of posting my entire files and such, I'll make a brief example of my situation and my desired outcome. My files consist of my document class entitled Engine.as and another class Abilities.as all within the same folder. On my stage I have a MovieClip with the instance name of item1_mc. On its personal timeline I have 2 frames, one entitled "inactive" and the other "active". Here's a sample of very similar code....

[Code]...

View 4 Replies

ActionScript 3.0 :: Accessing Document Class Of An Externally Loaded Swf With AS3

Aug 5, 2010

I have loaded one swf externally in my main class. and there is one button in loaded swf suppose its name submit_btn. i have to do that when i click on submit_btn, this loaded swf should be removed. what is the code for that

View 1 Replies

ActionScript 3.0 :: Accessing Document Class Function Within Timeline

Oct 10, 2010

have a very simple question, (Bear with me I'm still quite new to as3 and some of my terminology may not be solid) I want to access a function that is within my document class when a movie clip on the timeline has played to a specific point (being the end). I have already been able to call another function from the document class at the top/root level (it is called to initialize all clips and buttons when you click on the "enter" button on the splash screen. Problem is that I cannot call another function (in the document class) from a movie clip within a movie clip on the timeline. Is there an easy way to do this? I have considered writing a separate class for the movie clip and then adding it onto the movie clip (using the property panel). I don't really want to do it this way because I am already using a base class on that movie clip and 3 others that use a set of generic functions.

View 1 Replies

Flash :: Accessing A Variable Declared In Fla From Document Class?

May 24, 2011

On the stage I have a movieclip by the name of rect_mc. Inside it have have a MovieClip square_mc.In the time line that I get when I double click on rect_mc (timeline of rect_mc) I have written the following code

var width1:Number;
width1 = sqaure_mc.width;

How can I access width1 from the document class?The thing that I want to is access the variable declared (width1) in the timeline of rect_mc. Just for the sake of a example only I choose the width of MovieClip.My doubt is how can access a variable declared inside the timeline of rect_mc from the document class. It could be any variable.My document class is:

package
{
import flash.display.MovieClip[code]....

View 1 Replies

Flash :: Sending Variable From Fla To Document Class And Then Accessing?

May 31, 2011

I want to find out whether my swf was loaded locally or from another swf. For this purpose I have declared a variable 'parentType' in my fla. var parentType:String = String(parent); There is a function in the document class that determines whether swf was loaded locally or from another swf. The name of the function in the document class is 'externalOrInternal'. The varaible parentType is passed as a parameter to the function externalOrInternal externalOrInternal(parentType); The name of the document class is Main. In the constructor of Main I have the function pollResize() (the use of this function is to listen for the resizing event. That part of the code is not shown in the snippet given below).

[Code]...

I see that swfParentType is has value insde the function externalOrInternal. My doubt is why null is traced inside the function pollResize. Why is it not [object Stage] as inside externalOrInternal. Due to this I am not able proceed further with the stage resizing event.What needs to be done so that proper value is traced in the function pollResize.

View 1 Replies

ActionScript 3 :: Accessing All Instances Placed In Different Frames From Document Class?

Aug 11, 2011

I have programmed a game using the Flash authoring tool and a document class. I'm trying to graphically add instances and add functionality in the document class. Suppose I have a main timeline with 3 frames, each frame reperesents a different level of the game. In frame 1 I have an instance of the MovieClip class named tree1 on the stage and in frame 3 I have an instance of the MovieClip class named tree3 on the stage. In my document class, after an initial stop() command, I want some logic like:
tree3.scaleX = tree1.scaleX;
But tree3 is unknown to the runtime since we are not of frame 3 yet. Any way to access all the instances on all frames declared in the authoring tool from the document class?

View 1 Replies

ActionScript 3.0 :: Accessing A Method In A Class Document From The Timeline?

Apr 11, 2010

I have built a button in the fla timeline and need to have it fire a method in a document called gigyaSocial. the Timeline code works fine but I cant get it to recognise the method that I commented out at the bottom if this code snipit.

ActionScript Code:
import fl.controls.Button;
import com.player;
import com.gigyaSocial;

[Code]......

View 9 Replies

ActionScript 3.0 :: Accessing Objects In Document Class From SubClasses

Apr 26, 2010

I'm trying to access a MovieClip object in a SuperClass from a SubClass. The only way I can tell this is possible is through an event dispatch, but I'm dealing with a preloader and a loaded external SWF. So I can't make an instance of the "not yet loaded" classes because I'll get errors. Furthermore, the objects in both SWF need to be controlled in sync.

View 9 Replies

ActionScript 3.0 :: Accessing Document Custom Class Variable

Jun 15, 2010

I've made a custom sound class:
ActionScript Code:
package {
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundTransform;
[Code] .....
What I would like that class do is to trace a variable that is on Main.as which is Document Class, after a sound completed playing.

View 4 Replies

ActionScript 3.0 :: Accessing Methods In Loaded Document Class

Feb 9, 2009

I'm trying to access an init method I've set in one of my document level classes.

Container Movie loads Main Movie, which has Main.as as its document class, but I want to do a few things before I show the actual content. Here are some functions in Container.as:

Code:
public function moveLogo(e:TimerEvent):void{
loadTxt.visible = false;
var logoMoveUp:Tween = new Tween(logoCont, "y", Back.easeIn, 221, -250, 1, true);

[Code].....

If I trace e.currentTarget.content.init on my EVENT.COMPLETE callback function, I get "function Function()" like I should.

View 2 Replies

ActionScript 3.0 :: Accessing Library Items Outside The Document Class?

May 3, 2010

I've been running circles around this preloader I have for days now. There's a number of problems, but the main one I can't seem to figure out is how to retrieve a library asset from an external class that's not the document class.I have a Preloader_mc class in the library. But the Document.as class doesn't need it really. I only need it once I instance the actually Loading.as class. So I'm trying to access it from the Loading.as and I'm not getting anywhere.I also gave up by instancing it in the Document.as and then referencing it by:

Code:
Master.preloader_mc
or

Code:
Master(root).preloader_mc

Static or not, I just wanted access to the thing for once. Which worked until I had to remove it from the Loading.as. Then it wouldn't budge no matter what I typed.

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved