Actionscript 3 :: Can't Access MC On Stage
Mar 15, 2012I have 54 MC's on stage, generated dynamically. Now I want to get their x and y positions when rolling over but I am having problems getting the path correct e.g.[code]...
View 2 RepliesI have 54 MC's on stage, generated dynamically. Now I want to get their x and y positions when rolling over but I am having problems getting the path correct e.g.[code]...
View 2 RepliesI can't access a variable on a the stage from within a movieclip thats placed on the stage.
View 4 RepliesI'm trying to get a projector file to run full screen when it starts, without needing to click anything. My main class inherits from MovieClip, so as far as I can tell I get access to stage..
[Code]...
I have a MC, instance name "jez_mc" this is inside an MC, instance name "container_mc". container_mc on on the stage.I then have an MC dynamically added to the stage. In this MCs timeline I want to access a variable stored in the class that is linked to jez_mc. This var that I want is named "score"So i figured in my timeline I could use something like:
var _jez_mc:MovieClip;
_jez_mc = MovieClip(root).container_mc.jez_mc;
trace("_jez_mc.score");
[code]....
The 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?
I'm having an issue accessing items on the stage from some imported code. I found this topic that discusses the same issue... [URL]
I'm not sure I totally understand how to go about this. I don't understand how to make the object global so I can access it from any class. (I have the same problem with an array I'm working with).
I'm using Flash CS5. I have some instances on my stage declared in the main class and I want to attach some events to them, however at the time of the main class constructor, these are declared as null.
What's the best practice for accessing stage instances? Is there an event listener I could add that will tell me when the stage instance properties have been populated?
Simple example:
public class bleepBloop extends MovieClip {
public var productName:TLFTextField;
public function bleepBloop() {
trace( productName ); // Here it is null
}
}
However, when I access productName later, it's defined.
I have:Stage -> SWF Loader Root -> SWF Loader -> MovieClip -> Nested MC.From within "Nested MC": I can only access "SWF loaders root" time line, I can't seem to get access to the stage's functions..[code]Im trying to call on a function which resides on the main time line.Is there any way to access the main timeline?
View 1 RepliesThis may be a stupid questions but I can't find it.I'd like to refer to movieClip onStage by looping though it for example, I have 10 movieclips name slot1 - slot12 then in my code
var hole:MovieClip;
function checkHit():void {
hole = pirate.slot3; // My problem is here how do i change this slot3 to slot 4,5,6 ...
[code].....
how can i access Stage. inside a class?
View 9 RepliesI have a MovieClip MainGame that is associated with my external AS File where all the code lies. Everything works really well but.. I place an object inside the MainGame movieclip and give it an instance name . Now when I try to access it from the .as it says "Access of undefined property xy.."
I tried it with textboxes and movieclips, all the same.. I know it worked 20 times exactly like this and I have even compared an older Game where I accessed it just like this.... I really don't know what Flash is playing on me..
How can i access the stage from a class? Let's say i have
Code: Select all
public class Photo extends MovieClip {
....
//contains a photo
[Code].....
I have a swf that has a loader that loads in a external swf. Immediately I can't acess the stage anymore on the loaded swf. How do I go "up" the hierarchy to access it?
basically how do I access the stage from contactForm? if I'm using data classes for both swfs?
this.stage.Stage.homeMc.contactForm
Here is an example: [URL]
I am try to get the gray number at the bottom to be loaded into the swf code:
this.jackpotName1.line2.text = promotion.slide[GRAYNUMBER].JackpotName1.text()
here is my code
Code:
package
{
import flash.events.*
import flash.display.*
[Code]....
does it have to do anything with ADDED_TO_STAGE event?
I have var on my stage and i want my class to be able to accessthat var.Here's what is on my main.fla:
Code:
import ShapeOuts;
var ShapeDetect = 0;
[code].....
I am creating a fullscreen (no scale) site, so I am placing the position of my movieclips by referring the stage.[code]...
that code sets the x property of the movie clip fine when stand alone but when loaded into another swf it has trouble accessing the stage.
How can I access the height and width of the stage from a child swf? I have already tried both parent and root which give no errors, however they are not tracing proper values and are throwing everything in the wrong place
For a project i am needed to move a vast range of movieclips over time on the stage.I thought to write a class to tackle it. my little class experience tells me you can't acces the stage in the constructor. well great, just add an eventlistener for the ADDED_TO_STAGE. I wonder how to pass the stage.stageWidth to a custom class as an optional parameter.[code]
View 6 RepliesIf I wanna to access a variables which located on frame 1 of the main stage, can I write a script to access that in a movieclip which located in frame 2?
Or the movieclip has to be in frame 1 to access that variable using parent method?
So I've got a swf that's loaded from one domain into another, without the host swf setting Security.allowdomain.The problem is I'm using comboboxes in the guest swf, which try to add a few listeners to the stage.I'm able to work around one issue by setting a flag when a CB is opened, then having a catch-all mc listen for clicks, see if they're open, and close them and use focus manager to shift focus.
View 1 RepliesI'm trying to access a MovieClip created within the authoring tool from an ActionScript class. Here is my code:
PHP Code:
package {
import flash.display.*;
public class MoreVideos extends Sprite {
[Code].....
I also tried changing that to [stage.moreVideosBox.visible = false;], but I then got "1119: Access of possibly undefined property moreVideosBox through a reference with static type flash.display:Stage."
Is it possible to directly alter items in the authoring tool from a class? If I move 'moreVideosBox.visible = false;' outside of the class, in the main .as file, it works fine.
i have textfield myTxt on stage, and i have Room.as class file.
Actionscript Code:
package { public class Room { public function Room() { // constructor code myTxt.text = "yo!"; }
I need to access objects on stage from within class.
I'm passing a stage reference to my class, but when I try to access a movieclip on the stage I get an error.[url]...
View 9 RepliesThis is for AIR: My document class imports a separate class "ConnMonitor" and uses it to constantly monitor the network connection. It's at the very end of that class where it's supposed to update a textfield on the stage as the connection changes, but the class can't access the textfield.
View 8 RepliesI have a movieclip on the stage (MC_01) that has a button in it (btn_tip_ows). I need to to get it to work from the main timeline. If I place the button on the main timeline, the following works.
[Code]....
I have encountered a problem when I need to load a third-party flash in to my flash. The flash is written in an erroneous way, it access stage in the main class constructor. I know that a display object can not access to stage property until it is added to stage, and certainly can not access to stage in its main class constructor. I observe 2 cases:
- If the flash run STANDALONE, it run well: I don't know why stage is assign before its constructor
- If the flash is LOADED by my flash, it yield null reference exception as expected
In the second case, if the third-party class remain unchanged, is there a workaround that load flash?
How do I access the stage in Actionscript 3 in a class which is not my main class and not a displayobject?
View 4 RepliesAccess stage objects (like Movie Clip or text fields) from sub classes.The problem came when I define a subclass and try to access stage objects. How can I do that?Imagine I have a movie clip named redBox_mc on the stage.I want to change it`s alpha after I get my xml loaded.(or any other action in subclass)
Main class:
package src{
// ..
public class code01 extends MovieClip {
public var rt:xmlReader = new xmlReader("art.xml"); // my subclass
[code]...
I have an object on my stage, called obj.I also have a class called "Physics" which contains a bunch of methods for physics, such as inertia, gravity, and bouncing off walls. In order to do some of these,I need access to the stage.stageWidth and stageHeight properties.My code is as follows:
public function wallBounce(obj)
{
this.stageRef = stageRef[code]...
This is supposed to check if the object's x value is greater than the stageWidth or less than 0. When I run this code it says:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
I am a semi-newbie programmer who is completely self-taught and have no clue what is causing this. I spent a bit googling it, and I think it has something to do with scopes,.
public class MyClass extends MovieClip {
public function MyClass():void {
my_mc.addEventListener(MouseEvent.CLICK, action);
}
private function action(e:MouseEvent):void {
[Code]...
I can't able to access the my_mc(placed in FLA) movieclip. How do I access?