ActionScript 3.0 :: What Is A Stage And Root
Mar 26, 2009What is a stage and root? What is a frame and timeline?
View 5 RepliesWhat is a stage and root? What is a frame and timeline?
View 5 RepliesI have a root stage, and a MC that is called from the root stage.Now from that MC, i will called in another MC2, and I wanted to placed the MC in the center of the stage. The reason I could not use normal ADDED_TO_STAGE at MC and define the center is because MC is not place in the exact position of the root stage (as in x, y=0). So if I would target MC2 at MC stage center, it would not be the exact center of the root stage/screen.How can I called the root stage properties rather than adding MC2 into the stage?
View 1 RepliesI have a class called shapeC that only creates a rectangle and then addChild(rectangle);. That class is instantiated on the main timeline. Currently, the only way you can see that rectangle is to add the instantiated class to the stage via addChild(shapeC);. My question is, is there a way that the shapeC class can add the rectangle to the root stage without requireing the instantiated class to be added to the stage?
View 4 RepliesOkay, I did a search on stage and got a lot of forum threads going in different directions about static and global variables. _root to my understanding no longer means the main timeline, it's the root of...what? and how does this relate to the stage? Is the stage there or does that need and addChild() as well? Like, overall I guess my main question is, "What is the proper way of incorporating stage and root in document class structure?" I built my entire site using the structure, but I learned halfway through that I had to use addChild() to make it a display object. I'm trying to get this down so next time I get it right.
View 3 RepliesThe code below returns the error message "Error 1120: Access of undefined property stage."
function select(event) {
if (event.target.name is Stage) {
currTool.target = null;
} else if (event.target is Sprite) {
[Code]....
I understand the reason for the error is because I'm trying to access the "Stage" when I'm not at my Document Root. The question I have it how do I do this same thing when I'm not at the Document Root?
Questions are easy (Have I lost my mind?) -- and i don't think this (scuse the pun) gets much easier. Ahh but the answer... 400x500 stage, single layer (or with the AS in a 2nd layer) with a jpg (80x250) centered on stage and symbol'd to graphic (or mc). why doesn't the following function traces appear when mousing in and out of the stage?:
[Code]...
So I'm trying to do a simple graph with rollover definitions. I have the graph on one layer in the root along with the definitions. On a hit testing MC I have the following:
var defbox:info = new info();
var mcName = this.name;
var xPos = (MovieClip(parent).stage.stageWidth)/2;
[code]....
Is there a way to tell flash to instantiate a Stage subclass called "TheStage" instead of the default Stage class as root/parent of my document class?
public class TheStage extends Stage{
//code
}
Then when I do "DisplayObject.stage" I want it to return the instance of TheStage instead of the default Stage insteance. I want to do this so that I can override the addEventListener method of the Stage class. So if I call DisplayObject.stage.addEventListener I can execute my own code routine. Is that possible and how?
how can I get a display object on stage/root from a class?the text field txt is in root, but how can I get it from a class?
var txt = new TextField();
with(txt){
type = TextFieldType.INPUT;
[code]......
trace(root.width);
trace(stage.width);
Both these return 100. Same for height. The stage has been set to 1024x620 in the editor.I'm using CS5, Flash version 10, windows7 64-bit.I don't get what's going wrong here. I'm trying to center something and it keeps coming out like this.
I fixed this error before where the source of the problem was that 'stage' was inaccessible from where I was putting the code (not in root). I deleted it and it ran fine, but the Event listeners that they were attatched to did not work anymore. I need these event listeners but when I try to put 'stage.' back infront it wont work.
This is what I had when it worked (when this file was still the root):
stage.addEventListener(KeyboardEvent.KEY_DOWN, keypressed);
stage.addEventListener(KeyboardEvent.KEY_UP, keyreleased);
Now my code is this, and it runs, just without the event listeners working:
addEventListener(KeyboardEvent.KEY_DOWN, keypressed);
addEventListener(KeyboardEvent.KEY_UP, keyreleased);
I have a movieclip "submenu" that is on the main timeline, and inside this movieclip, I have some ActionScript:
[Code]....
h1. I have a Class (let's call it "Button") that is linked to a library item (a movieclip) which I have on the stage
2. Now this Button class, when clicked will produce an alert in the form of another class (let's call it "Alert").
3. There are two critical things in the way I want this to work:
A) I want Alert to be a child of the main stage, not the Button class
B) I want Alert to take care of adding itself to the display list, not have Button add it.
So in a nutshell, I want to call Alert like this:new Alert("Hello, Kirupa Forums!");
The Alert class needs to draw the shape (check), add the text (check), add itself to the display list (how? if I try to access "stage" I get a null reference, though I don't know why), and destroy itself (I'll burn that bridge when I get to it).
I am new to AS3 and only recently have been able to understand the display list.I am trying to run this code in my file.I made two movie clips in my library. Gave them class name as "One" and "Two"Now, this is the code that I run:
Code:
var one:One = new One();
var two:Two = new Two();
[code].....
how to attach a movie clip to the stage or root. I have created a movie clip called movClip and have checked export for actionscript and have chosen "movClip" as its class.I have used this script:
ActionScript Code:
function button1(evt:MouseEvent):void {
var mc1:movClip=new movClip();
mc1.x=0;
[code]....
This attaches the movie clip. Great! Problem is it doesn't attach the movie to the root or stage, but rather as a child of this function?? weird! so when I want to use removeChild(mc1) from a different function from a different button or even from an action set on a different timeline it can't target mc1?So how do I make this work. Basically I want one function from button 1 to attach the movie clip and I want a second function from a second button to remove the movie clip.
currently working on my first AS 3 project. The transition from AS 2 to AS 3 has been tough but rewarding. However, still fiddling with dynamically created objects though (using a database for my site-content). Here's my problem: If I dynamically create a MovieClip I can no longer access the main stage. Since I'm using a mousedrag interaction I need a global MouseUp Listener. If I try to access 'stage' or 'root' or 'parent' from within the dynamically created MovieClip the result is always 'null' instead of what's really there. Is there an easy way to access the main stage from within the created object?
View 3 RepliesIf I have a movieclip loaded with Loader and I want it to call back down to the movie that loaded it how do i do that? Referencing a root object just gets me to the root of the child not to the main stage.
View 1 RepliesI am loading the SWF just fine, but I want the SWF to fit the root stage exactly. What happens instead is that the external SWF seems to include white space from around itself.
For example, the author-set width of the Tanks game (an example file I was using) is 550px, but when I set the width of loadEvent.currentTarget.content.width to 550px, the game is resized to maybe 350px width. I have to set the value of loadEvent.currentTarget.content.width to something like 640 in order to get the game itself to make full use of those 550 pixels.
Code:
package {
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
[Code].....
I have CS4 with AS3. I hard-coded values for cWidth and cHeight instead of getting them from flashvars because I am just testing in the IDE right now. Normally I would get those vars from flashvars.
Just need to figure out how to pass root level variable to a movie clip which contains a dynamic text box to display the passed variable. How is this possible? I usually use global variables when i was coding in AS2...but it appears this feature is dropped in AS3.
View 4 RepliesI want to know the difference between [object main timeline], stage and root in as3.
View 1 RepliesI have a MainClass from where I can call Stage. In the MainClass I call another class named Subclass, and in that one I call my ThirdClass. ThirdClass is initialized fine, but my problem appears when I want to call the Stage within the ThirdClass, to align the Stage. When I compile I receive the message: 1119: Access of possibly undefined property align through a reference with static type Class.
[Code]...
I want to know the difference between [object main timeline], [object Stage] and root in as3? I have read from the topic How stage, root, and MainTimeline Fit Together. But I didn't get clearly.
View 3 RepliesHow do you align a dynamic movie clip position with another movie clip which is in the root stage? I tried to get the mc in root x,y position, but the starting point of the class that loads the dynamic MC does not seems to be accurate. (Meaning at the root stage, the x,y is 0,0 but at the dynamic class, its somewhere like 100,20 for the browser area (and it actually vary base on the browser size))
**the other classes I used to run the custom classes below, I have it added this MC to stage
var blocker:stageBlocker=new stageBlocker();
this.stage.addChild(blocker);
Below is the dynamic MC. Should I not add it to its own "stage"?
public class stageBlocker extends MovieClip {
private var blocker:MovieClip= new MovieClip();
public function stageBlocker():void {
[Code].....
Situation:
- We have a Flash application located on a SAP EP (let's say ep.x.com)
- We have a SAP ABAP Application (Webservices) on a SAP WebAS
server (abap.x.com)
- Clarification: This is not about Flash islands / but a normal Flash application communicating with WebAS ABAP via WebServices
Problem: Due to the changed security policy in Flash 10 this scenario does no longer work.
- A crossdomain policy file on root level cannot be deployed on root level
- The WebServices http/s headers cannot be modified, since the WebServices are generated by the WebAS IDE.
Comment: Technically there is a way to patch a WebAS ABAP,but this is not a practical / acceptable way in a normal SAP WebAS infrastructure.
Conclusion:- The above scenario (Flash from EP content / WebAS ABAP as backend) is a quite normal scenario in the SAP world.
- SAP / Adobe always features the close relationship between their technologies.
Question:- What could we do?
- How does the Visual Composer works around that problem?
How do you tell the root timeline to root.gotoAndStop(2); from the timeline of a movieClip added using addChild?In the maintime line I have
addChild(fade_eng);
and in fade_eng I have the following on frame 20
root.gotoAndStop(2);
this.gotoAndStop(1);
But I am getting 1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:Stage.
Run the following code, once with block.mouseEnabled = true, and again with block.mouseEnabled = false, clicking the block once during each run.[code]...
Why is "root" skipped as a target? Is this by design? What is or what might be the design reason for this anomaly?
I ask this because it's a clear a break from the normal pattern where when the child object has mouseEnabled set to false, the parent becomes the target when it's child area is clicked.
I have a button in my main file (Interiors-02.swf) in Scene 1. When I click it it loads an outside swf (buttons.swf) into a blank movie. This movie has 10 buttons. What I want is for when I click one of those buttons to go to Scene 2 or 3 in the main file (Interiors-02.swf) Can I do this and what would the code be for the button?
View 1 RepliesI have a varible in my root
Code:
place = "1";
i want to refence it in one of my MCs so that i can run a statement like this:
[code]....
I have my main fla and then I have a actionscript named bullet.as in the bullet.as I create a bullet using "this" throughout the script now how would I call the bullet on my main timeline?
View 1 Repliesi have uploaded a simple 1 page website with the flash video sitting outside of the root folder of the site itself. i have pointed the flv playback components to the video and published it and uploaded it but the video does not appear on the pages.
View 1 Replies