In my document class, I am instantiating a class like this:
cues = new CuePoints(); cues.addEventListener(CuePoints.CUE_POINTS_CLASS_ADDED, setCuePoints); addChild(cues);
[Code]....
If I try to reference a MC that sits on the stage called videoPlayer_main like so: stage.videoPlayer_main I get the following error: 1119: Access of possibly undefined property videoPlayer_main through a reference with static type flash.display:Stage.
I am currently working with a contractor company that is hosting a flex based website. They are putting the swf files that I have developed into their flex site.The issue that I am having is that within my swf file I need to reference the stage.I do this by "MovieClip(parent).stage"... I do not use the keyword "root", I just reference my swf's root through however many "parent"s i need. It works fine when I publish on my own, outside of their flex site. When it is used in the flex site, they are getting an error that they cannot reference the stage/ stage is null. It is vital that I am able to reference the stage of my swf.
I'm writing a function which can take the names of different variables and use them to do some calculations. Long story short, I want to be able to call the function like this:
It probably seems like a really roundabout way to pass the variable through its name rather than just passing the variable itself. This is related to me using XML to get the variable names, so they come in as strings. Just bear with me here.
Inside the function, I want to be able to do something like this:
which should then trace the variable's value. Unfortunately, I just get an 'undefined'. How do I use 'this[]' to get the value of the variable from a string corresponding to the variable's name?
I'm writing a function which can take the names of different variables and use them to do some calculations. Long story short, I want to be able to call the function like this:
function caseConditionEvaluator( nameOfVariable:String )
It probably seems like a really roundabout way to pass the variable through its name rather than just passing the variable itself. This is related to me using XML to get the variable names, so they come in as strings. Just bear with me here.
Inside the function, I want to be able to do something like this:
trace( this[nameOfVariable] )
which should then trace the variable's value. Unfortunately, I just get an 'undefined'. How do I use 'this[]' to get the value of the variable from a string corresponding to the variable's name?
I am unable to view the majority of the downloadable standalone ActionScript 3.0 Language Reference.To replicate:
1) Download the file from [URL] ndalone.zip.
2) Expand the zip, open the resulting folder and open the index.html document in your web browser.
3) Pick any filter link you desire from the choices on this page. Notice that the package and class filters in the header continuously display "Retrieving Data from Server..."
4) Click on the Classes link in the header at the top.
Result: The class list displays only momentarily, then completely hides.
It would be great if there was a way to completely circumvent the filters. There appear to be several missing linked elements in the download, such as en_US/shared/ahpods/AHPod.js.
I'm setting up a class of public static vars that are to be BitmapData.
The problem I'm having is I can't seem to reference the vars dynamically in an array, making it impossible to give them values without some serious procdedural style coding.
Should I assume it's because my array is a private var and placing references to public static vars is illegal? Is somebody gonna call the flash police on me?
I have 9 MovieClips on stage (p1, p2, p3...), different colors and sizes. I have one AS3 class -Snake- that as an instance is supposed to duplicate one of these MC's as a Shape. The reference to the specific MC is supposed to be on the constructor method. These instances are supposed to be triggered from one global Enter.FRAME event.
My question: How can I refer a distinct MC from within a class? I ask this because this MC will be dynamic and its properties ever-changing (position and color). I know this can be solved by adding distinct Enter.FRAME listeners per instance, but I'd rather avoid bad practices.
I am currently working with a contractor company that is hosting a flex based website. They are putting the swf files that I have developed into their flex site. The issue that I am having is that within my swf file I need to reference the stage. I do this by "MovieClip(parent).stage"... I do not use the keyword "root", I just reference my swf's root through however many "parent"s i need. It works fine when I publish on my own, outside of their flex site. When it is used in the flex site, they are getting an error that they cannot reference the stage/ stage is null. It is vital that I am able to reference the stage of my swf.
I'm trying to get a small popup (a volume bar) to work from within a class.I made a piece of actionscript code that creates an empty movieClip and draws the bar into it and made it onto a class. The only thing I now have to do to add the bar to a programm, is create an instance of that class. Nothing needs to be added to the stage.The problem I encounter is that I need the bar to stay on top. New movieclips always get higher depths (using getNextHighestDepth()), so that's a problem.Calling swapDepths() for every new movieclip is far too complex and afaik there is no such thing as "bring to front" in actionscript, it only exists at design time, not at runtime.
So I though I'd use 2 layers/movieclips in the timeline, one for the volume bar and one for the rest, and add an empty movieclip to both.This way I know that all children I add to one movieclip will alway lay below anything I add to the second movieclip. (or is there an easier way to accomplish what I need? Levels maybe? I've never looked into levels, I only know they exist when loading a clip)This means I need to add a some extra stuff to the stage at design time, but if this fixes the issue.. ah well.But how can I access that movieclip from within a class? The reference "_root.volumeBarPlaceholder" works from within the main actionscript, but not from within a class because I get the compiler error "There is no property with the name '_root.volumeBarPlaceholder'";
How do I reference the stage from a class? I need to add eventlisteners to the stage for mouse movement. I also need to add custom cursors. I always get an error when I try to reference stage. anything. Or event if I do this:
I have some object, which extends movie clip:public class MyClass extends MovieClip Now, I want to put two of this in the stage:[code]That would put one, but the other I want it to be exactly the same as the first, so I just need to add a "reference" of obj to the stage, along with obj itself.In the end, I want two objects of type MyClass doing the same thing in the stage. If I try to simply do:[code]only obj2 will appear in the stage.How could I achieve that with references? (in order to save memory and CPU time (it is really important))
I'm playing around with some classes from my Learning AS 3.0 book in an attempt to understand them. I have a main (document) class, and a class called NavigationBarXML.
Because the buttons for the nav bar are all set up in the subclass NavigationBarXML, I would like to position the nav bar relative to the stage (think btn1.x = stage.stagewidth - 50) from within this class. I understand that you cannot deal directly with the stage from a subclass and that you must add it to the display list before you can reference the stage from within this class.
How would I set up the main class so that I can reference the stage from my subclass so that on browser resize, my nav bar is positioned relative to the stage?
I have a static utility class that must have a reference to the stage, and I'm not sure what is the best option for me to get the stage inside my class...
I've thought of these options:Pass in as a parameter of the function Have a static variable I can set to the stage I don't like either of these because they are ugly.
What methods can you suggest for me to get a reference to the stage in my static class?
from my documentclass i got a isntance of the my view class in there i got a instance of navigation class extends Sprite I got a utilz.as file with all static public functions like this one
alignToCenter(obj:DisplayObject):vid { obj.x = obj.stage.stageWidth/2; } Utilz.alignToCenter(instance of navigation class)
Ive got two classes and my stage. I'm trying to use an array to keep control of my enemy class's number for collision purposes and I managed to get the enemies to populate the array.
In simple example, I have a class called RedSquare that extends a Sprite. I need to have it in a central position of the stage. I do not know if importing definition of Stage class to RedSquare changes anything, but in the constructor of the class i could write [code]...
I have 9 MovieClips on stage (p1, p2, p3...), different colors and sizes. I have one AS3 class "Snake" that as an instance is supposed to duplicate one of these MC's as a Shape. The reference to the specific MC is supposed to be on the constructor method. These instances are supposed to be triggered from one global Enter.FRAME event. How can I refer a distinct MC from within a class? I ask this because this MC will be dynamic and its properties ever-changing (position and color). I know this can be solved by adding distinct Enter.FRAME listeners per instance, but I'd rather avoid bad practices.
ActionScript Code: public function Snake(id:MovieClip) { body = new Array(); head=new Point(id.x, id.y); size = id.width; color = getColor(); // need to have a class variable that refers to the index [Code] .....
1) I have a movieclip instance on stage (simple graphical element that represents platforms for a hero to run and jump along). I have placed it on the stage with an external class engine.as and in this class it is called myPlatform and is an object of Platforms.as. The movieClip is called platforms and from a trace(myPlatform.name) the instance name is instance3.
2) I am attempting to access the properties of myPlatform in an Enterframe event loop in my character control and collision class (called hero.as)Basically here is the bit of code I am trying implement within Hero.as :
if (myPlatform.hitTestPoint(x,y,true)) { // if a platform is hit trace("hitME"); y--; tGravity = 0; // reset break; }
Here's the error that I get:
1120: Access of undefined property myPlatform
This all worked when I was writing actionscipt within the FLA file, on the timeline frame 1.I simply don't know how to access myPlatform from within the external Hero.as class! Do I need to create a variable?
I have an array of MovieClips, when I try and use .removeMovieClip on one of the array items it removes reference to the MovieClip Object but it is still visible on the stage. When I address the MovieClip directly and use removeMovieClip on that it removes references and deletes from the stage.
i.e. Scenario 1: myArray = new Array(); myArray.push(myMovieClip); myArray[0].removeMovieClip(); trace(myArray[0]); trace(myMovieClip); Traces out undefined, undefined but the movieClip is still visible on stage (and can still interact with).
Scenario2: myArray = new Array(); myArray.push(myMovieClip); myMovieClip.removeMovieClip(); trace(myArray[0]); trace(myMovieClip); Trace out undefined, undefined and the movieClip is removed from stage
I have created a custom class that extends the movie clip on frame 1 of the main timeline I create it var mainBox2:mainBox = new mainBox(); addChild(mainBox2); Now as I understand it you have to cast the parent as a MC so in the constructor of my external class I try this var myStage:MovieClip = MovieClip(this.parent); trace (myStage); I get null. What am I doing wrong?
I'm unable to load forces.swf (assume I can't edit it, as I don't have the source code) through an external swf, due to Stage reference in the base class how would I go about loading it (and any other possible SWF) without errors being thrown?
Here is a link to the problem I am trying to fix:[URL]..
I am currently having problems referencing a MovieClip child which I add to the Stage from the Document Class. Basically when the MovieClip child is added to the Stage from the Document Class, I want a certain MovieClip already on the Stage to reference it once it is on the Stage.
Also, if it is possible, I don't want the MovieClip referencing the child being added to the Stage to have parameters linking it with the Document Class, because I plan on nesting this MovieClip within another MovieClip later on in the future.
Here is the code for the MovieClip class which is referencing the child once it is added to the Stage:
I have created a XML driven shell where I'm calling external SWF files reading from the XML.ome of the SWFs has SCROLLPANE from the component panel of Flash is added on their respective stages. Now if I'm running those files individually, they are working fine. But it is loaded in the shell the below issue is coming.
TypeError: Error #1009: Cannot access a property or method of a null object reference. at fl.containers::ScrollPane/setScrollDrag() at fl.containers::ScrollPane/draw() at fl.core::UIComponent/drawNow() at fl.containers::BaseScrollPane/get
when to use this in a classes?is there any specific rule?is it wrong to use this when you want to just access the stage that way?or is it better to pass the reference to the stage in the class constructor?
I'm unable to load forces.swf (assume I can't edit it, as I don't have the source code) through an external swf, due to Stage reference in the base class.
How would I go about loading it (and any other possible SWF) without errors being thrown?
In a game me and a friend is creating, the levels are stored in MCs.In the level MCs there are several other MCs that the player should be able to interact with.
This means the objects in the levels need a stage reference.I can place all the objects manually and pass the stage ref in the constructor of the object's class, but this is a pain when the levels are going to be pretty big.
Is it possible to make sure that flash always passes a stage ref to the object even though it's not placed there by code?