ActionScript 3.0 :: Accessing Things On The Stage?
Sep 15, 2008
I have a movie clip on the stage. In the main .as file, I can easily access the instance i.e., myMovieClip_mc.x = 10; How do I do that from a class in my "classes" package? I am passing the stage instance into the constructor of the class, so I would think something like myStage.myMovieClip_mc.x = 10 would work, but it comlains that it is null.
View 1 Replies
Similar Posts:
Sep 1, 2010
I have a menu movieclip that has 800 x 22 px i need to embed this flash menu in a jsp page and make that the displayed menus got outside of this size and overlay the contents of jsp. kinda of what does the menus of the adobe page
View 1 Replies
Apr 22, 2007
is this possible? i have a box with falling stars and i want the stars to fall out of the box and be visible in html.
View 5 Replies
Feb 8, 2011
In my game, Ive got a HUD, (heads up display, life bar, points scorer etc...) and when an enemy comes onto the stage, the lifebar is appearing behind everything else, and it should really be the thing that's infront of everything else. Is there like a line of code and a function or variable I should declare or import that allows me to create depth and put my lifebar at the front.
View 2 Replies
Apr 29, 2010
I am making a site in flash. Without a preloader everything appears on the stage fine. Once I add a preloader I can no longer see certain things on the stage. I know they are on the stage because I can call them through code and I traced their getChildIndex and they are the same across both files. Files w/ preloader and problem:[URL] The main file is Test.fla. The code that adds the objects that I cannot see is in Test.as and the objects that I cannot see are menuBG, menuBGL, menuBGR, menuBGB, shader, grid, and imageStatus, or anything that is imported from the library.
Edit: The problem is caused by me exporting my classes in frame 2 which is needed by the preloader. In my init() function I tried adding gotoAndStop(3);
View 2 Replies
Feb 27, 2011
how to change stage size and get all things at center?
View 4 Replies
Nov 4, 2010
I am trying to delete a bunch of different things from the stage all at once.I have 3 dynamically created text fields and 2 dynamically created movie clips.I added them to the stage through my document class buy creating them, editing their properties and then...
addChild(myText1);
addChild(myText2);
addChild(myText3);
[code].....
View 3 Replies
Jan 1, 2004
I have a looped sound and some components in my main movie (scroll bar) which for some reason is really bogging down my swf and causing the preloader bar not to show up until like 46% or something ridiculous.So I am trying to solve the problem by having a preloader swf as suggested by Kode in this thread. However, now all my targeting is messed up in my main movie. Everything that was _root has to change but I can't tell what to load it into. I tried using _parent, _parent._parent, _root.container_mc (which is a blank movie clip created in the preloader swf that main is loaded into after the preloader is 100%) and others but nothing works. Even the simple looped sound which was originally just _root.backsound.start(0,999) can't be targeted.how to target things on my main stage based on the preloader swf?
View 14 Replies
May 14, 2011
- I have A.fla.
- A.fla includes buttons, movie clips and also B.swf is loaded in A.fla using a LOADER
- i want to access elements in A.fla, from the actionscript codes inside B.fla to modify those movie clips and buttons based on actions going on in B.swf
for instance, lets say there is a button X in A.fla, and there is a button Y in B.fla, B.swf is loaded into A.fla, and I want the button Y to erase button X when clicked.
general question: accessing elements in a stage, through a SWF file loaded into that stage.
View 2 Replies
Mar 6, 2009
I have a button, inside an mc1 which when clicked it plays
[TweenLite.to(mc2, 2, {frame:1});]
inside mc2 -which located back on the stage.
Currently I get the error of "access of undefined property)".
View 3 Replies
May 7, 2009
OK, I load an external SWF on stage.
I have a mc on there already, it's called 'darkOverlay' (instance name).
This is the code I'm trying to use to access it:
Code:
trace(stage.getChildByName("darkOverlay"));
if(stage.getChildByName("darkOverlay"))
{
MovieClip(stage.getChildByName("darkOverlay")).gotoAndPlay(21);
}
It returns null even when it's loaded in the main swf. What am I overlooking here?
View 9 Replies
Feb 20, 2011
I have created a movieclip (game_container_mc) in the main.as file and I want to add a child (enemy) to it from a different file (makeWave.as) how would I do this?
View 7 Replies
Apr 8, 2009
I seem to have a problem with accessing MC on stage. For example, if in my class I try to do something like this:
back_next_nav.alpha = .3;
I get the error: 1120: Access of undefined property back_next_nav.
View 1 Replies
Nov 10, 2009
I'd like to be able to access some objects which are on the stage before compile time (e.g. in my .fla file). I can do this fine from the document class using the names I've assigned to them, but I need to be able to do this from other classes (instantiated at runtime) too.
What is the best way to go about this? Can I use the stage variable (this isn't looking likely from what I've read so far) somehow? Or do I need to pass in references to these objects from my document class when I create the instances of the class that needs to access them?
View 8 Replies
Jan 4, 2012
I have several symbols in the library (using Flash CS5), and all of these instances have a custom base class set with a method (lets say x()). I have the symbols already positioned on the stage using the IDE, and I wanted to access them through as3 and run the method. I understand that you can instantiate a new object of an item in the library, but how would I access the object that are on the stage already?
var objectList:Array = new Array();
objectList.push(InstanceName1);
objectList.push(InstanceName2);
objectList.push(InstanceName3);
objectList[0].x(); //trying to run the method on the existing Symbol
However, flash returns an error saying that the object does not have method x(). Also looking through the debugger, it doesn't seem like the item pushed is an instance of the base class, rather it says (prototype). This works of course if I were to create a new instance of each, but I would rather access the ones that are on the stage already.
View 1 Replies
Jan 14, 2011
In the below example, stage is always null. If I move the listener for enterframe to TestSubClass, it obviously works OK (even if the added function remains in TestClass?) - but why can't I detect stage in TestClass and reuse that code for all classes that extend it?
Some code:
Code:
// ParentClass
var testClass:TestSubClass = new TestSubClass();
this.addChild(testClass);
[Code].....
View 2 Replies
Nov 28, 2011
I am having a problem referring to stage properties, where I am trying to e.g. obtain a third of the width of the stage. My code keeps throwing up the "Cannot access a property or method of a null object reference." I have found a few things from a search online, but haven't been able to work through it yet.
I should also say that I am working in flash and have made a movieclip with a movieclip inside (which is to be used as a roll-over menu for image thumbnails). The instance name of the 'parent' movieclip is "galleryPane"; and mc inside has an instance name "thumbnailsContainer" .Here is my code:
ActionScript Code:
package {
import com.greensock.TweenLite;[code].....
View 6 Replies
Oct 4, 2009
im trying to do a small card trick on flash cs4 using as3.i have 56 diff mcs on stage with instance names like c1,c2,c3,c4....c56.. and i need to acces nly 10 of at a time in a random order..i ran the random no. generating codes and got 10 diff random numbers (from 1 to 56) and stored it in an array as array[0],array[1] all this works fine.now how do i access the individual movie clips???[code]
View 1 Replies
Jul 11, 2010
In my flash document, I have a movieclip drawn on the flash stage (put there myself, not dynamically). I want to use this as a holder for an external .swf. I am using a sub-class to run the loading script. I pass the stage reference to it as the variable "theStage". It has no trouble loading things directly to the stage, but it can't find my movieclip for some reason. I have exported the movieclip for actionscript in the symbol properties panel and have given it an instance name.I've tried theStage.myMovieClip.addChild(mySwf); and suchlike, but always get this error message in output:ReferenceError: Error #1069: Property myMovieClip not found on flash.display.Stage and there is no default value.at MethodInfo-206()Some more information: It works from the main class without any trouble.
View 1 Replies
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
Apr 3, 2011
After quite some time I finally decided to pick up Flash again, this time taking the OOP route. I'm a bit rusty though, so I'm stuck on something pretty basic.Here's my Layout of relevant objects and scripts:
Stage > gunAmmo (TextField)
Stage > player (MC) > pistol (MC)
........ > player.as > pistol.as
As you might've guessed, what I'm trying to do is set the gunAmmo.text property from within my pistol class. I've tried using MovieClip(root).gunAmmo, stage, etc., but neither seems to be working. I sort of get why, but I don't know what the correct syntax is. (And yes, the TF's instance name has been set correctly.
View 2 Replies
Apr 7, 2011
From within a movie clip, I'm trying to update variables on my main timeline. I tried both _parent.variablename and _root.variablename, but neither worked.
View 4 Replies
Jan 7, 2008
I have a lot of actionscript drawing Sprites and adding them to the stage. I need to access them to animate them once they're added but I can't figure out how. Also, I read that a sprite has no timeline. If it doesn't have a timeline, that doesn't necessarily mean I can't animate does it? I mean, I should still be able to move it's position on screen or change it's color?
View 5 Replies
Aug 3, 2009
im still trying to get into the whole oop thing but I still have some things that i dont understand.I have a movieclip on stage that i want to access using an external class that lives in a different folder.Is there a way to access movieclips on stage from external classes or that i have to create a connection between the document class and then send the movieclip instance using a class method ?
View 1 Replies
May 22, 2010
I have the following code nested in a movieclip, how can I reference the stage correctly from that movieclip?
stage.addEventListener(KeyboardEvent.KEY_DOWN, reactToArrowKeys);
function reactToArrowKeys(keyEvent:KeyboardEvent):void
{
if (keyEvent.keyCode == 37)
[Code].....
View 8 Replies
Jul 22, 2010
I have a function in stage and need to call it from a child I do I do it...
// In main stage
var child_mc:mcChild = new mcChild();
addChild(child_mc);
[code].....
View 2 Replies
Feb 7, 2012
I need to set properties of buttons on the main stage from the current class. How would I do this?
I have multiple buttons on my stage. Each representing a chapter in a movie (from frame x to frame y of the movie).
When I push one of them, the movie plays. When it gets to the end, it should continue to the next segment/chapter. This works, but now I need to highlight the current button, not let the button I pressed be highlighted forever..
View 1 Replies
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
Aug 26, 2009
have a button on the stage that you called "myButt". Now suppose you want to change its size. You write:myButt._xscale = 25;Now suppose you don't know it's name, but you get the name from another variable:buttname = "myButt";How do you change its size then? in some compiler languages you can expand the string buttname into its value at compile time, with special flagging, such as:
View 4 Replies
Aug 29, 2009
I am trying to access the x and y properties of the stage so I can set an objects' x and y properties to place it on the center of the stage:
this.x=stage.stageWidth/2;
this.y=stage.stageHeight/2;
The call to instantiate the object(*.fla):
[code]......
View 4 Replies