ActionScript 3.0 :: Unable To Reference The Stage?
Nov 17, 2010
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.
View 2 Replies
Similar Posts:
Nov 30, 2009
i am able to successfully load a .swf into a movieclip called GameLevel, but now i am unsure how to reference the objects that are named within.for example, in the .swf i have an instance of my character named Hero, but i don't know how to reference him. the following code would usually return the correct movieclip:
View 1 Replies
Sep 19, 2011
So I am trying to access a variable that is defined within my parent code from a class which has been called from my parent code. I am using this:Code:TileCode(parent).game_quests.add_quest(0);to try to access the game_quests variable (which is defined within TileCode). However, for some reason it is not picking that up. It is working for other variables which I have called and ran in a similar fashion
View 7 Replies
Jun 17, 2009
PBar contains two SimpleButtons (pBarProgress and pBarLoaded) and a MovieClip (pBarBg).I import pBar from the library like this:private var pBar:PBar = new PBar();and add it to a container MC on the stage like this:containerMC.addChild(pBar);Up to this point, everything works great. I can see pBar and its children on the stage when I run my movie. But then I want to start referencing and manipulating pBar's child objects, but nothing I do works. Ive tried ...pBar.pBarProgress.scaleX = 0;var pBarProgress:SimpleButton = Bar.getChildByName("pBarProgress") as SimpleButton; pBarProgress.scaleX
View 1 Replies
Jun 9, 2010
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.
View 2 Replies
Dec 15, 2010
trying to set the stage with a color from the classic window and properties. However when I select a stage color it remains white, and will not change. I have tried everything I know how to do like uninstalling and re-nstalling, going through the endless files and forums.
View 4 Replies
May 23, 2011
what stage colour I assign to my document, when I export the SWF it's always displays as the default white. I've tried re-installing but this doesn't fix it.
This is just one of the bugs I've encountered in Flash. I'm sick of the amount of bugs Adobe simply ignore and get away with it.
View 10 Replies
Dec 3, 2010
I'm trying to resize my stage using this code but I can get it work correctly. (I'm using FLASH CS4)
ActionScript Code:
var Stage_height = flash.system.Capabilities.screenResolutionY;
var Stage_width = flash.system.Capabilities.screenResolutionX;
[SWF(width=Stage_width, height=Stage_height)]
When I launch it I get this ERROR Could not parse 'Stage_height' as a number for height. And the same for the width.
I tried to set them as Number variables but that didn't work either.
View 7 Replies
Jul 25, 2011
I have several objects created at frame 2 of my fla file, like:
Code:
stop();
var rotatorek:Rotator = new Rotator();
addChild(rotatorek);
var rpm:engine = new engine();
addChild(rpm);
etc...
After endGame is changed to true within one of my .as files, I got this error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at Rotator_fla::MainTimeline/ruszMaszyna()[Rotator_fla.MainTimeline::frame2:94]
Frame 94 is first removeChild(rotatorek).
Why I can't remove all those children? I need to go to frame 1 without any instanced objects and cleared listeners.
View 3 Replies
May 6, 2010
We are the developers of a complex Flash component (url...) which worked without issues on Flash CS3 and CS4. Now, in Flash CS5 (both Mac and Windows versions) we have found a couple of problems at author-time
-1- After installing the mxp file containing the component, when trying to drag the component from the Components panel to the stage, or to the Library panel, it doesn't work. There's no way to import the component!
-2- If we open an existing FLA (created with Flash CS4), the component doesn't show correctly at author-time: you only get a black frame, instead of the expected result (it should show a white background with a logo in the middle). When compiling, everything works fine.
View 2 Replies
May 5, 2009
I have embedded a flv video onto the stage. I then have loaded in an image which is transparent enough to see the video through it. The problem is I cant now access the video player to control it. Is there anyway to bring the embedded video on the stage above the loaded in image so I can actually click play on the control bar and play the video?
View 3 Replies
Oct 12, 2009
I've experienced an odd behavioral of flash and correct positing of objects, properly a bi product of floating point values.
case: Imagine 10 MC which expand and contrast with a damping effect, each MC's would then position itself to the previously MC in Y axis.
problem: when all objects expand and contrast and then reposition themselves to the previously MC, then occasionally there's a shift in the Y position which gives a white space of 0.x pixels.
I seem that either flash have an update issue or more likely there's a conflict in the way flash convert floating points to position the object on stage.
[Code]...
View 5 Replies
Apr 12, 2012
I have made index swf which is loading other child swf's into index these swf's are images.swf,portfolio.swf, about.swf etc.., I have made 2 public function in each swf which is construct or diconstruct. when i unload any swf then i play disconstruct public function of every child swf.. I stuck in when I remove stage event listener of every child swf then it shows error.
[Code]...
View 3 Replies
Mar 9, 2012
I made a textfield, and applied a textformat to it, but whenever i try to change its text to something else outside of "addChild(myText)" it just removes the text completely.
View 5 Replies
Sep 30, 2010
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.
[Code].....
View 1 Replies
Sep 22, 2009
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.
View 1 Replies
Sep 22, 2009
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].....
View 3 Replies
May 25, 2010
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'";
View 2 Replies
Sep 13, 2010
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:
[Code]...
View 20 Replies
Jun 16, 2011
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))
View 6 Replies
Oct 9, 2010
How can i reference objects on stage so i can push them into an array using a loop?[code]...
View 2 Replies
Aug 9, 2011
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?
View 9 Replies
Feb 20, 2009
i've a problem with my setFocus. i will use [n] to identfy the line in the code. this is a MouseEvent.CLICK - function from an other dynamic,non-selectable textfield. the textfield in work is one with an embeded font and some text in it.if i use line [3], i'll get the no blinking courser and no possibility to enter some words. also if i mark some other and click after that in the input-textfield directly there will no courser anymore.but this only happens in the first time using the swf. if i first click into the input-textfield, then set the focus to something else and trying the steps i wrote over here, everything works fine.
View 7 Replies
Feb 17, 2009
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?
View 8 Replies
Jul 4, 2009
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)
I get a error stage is null reference..
View 7 Replies
Nov 4, 2009
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.
View 3 Replies
Nov 5, 2009
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]...
View 2 Replies
Sep 30, 2010
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] .....
View 1 Replies
Nov 21, 2010
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?
View 1 Replies
Aug 22, 2008
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
View 3 Replies