Actionscript 3 :: Use MouseEvent For Getting Object`s Public Variables?

Sep 5, 2011

I have a simple problem which is not easy at the moment. this is a text field class which add a text field to a movieclip (passed from root class) and also save(buffer) some data (like xml file name) in it`s public variables:

package src {
import flash.display.Shape;
import flash.display.MovieClip;[code]............

.. now I use a for loop to add instance of that class to a movie clip on stage:

for (var i:int = 0; i<Bunker[0]["trans0size"]; i++) {
menuData[i] = new menuitem00(i, menu_mc, Bunker[0]["transfile0" + i]);// pass i , a movieclip named menu_mc and an xml file name
menuData[i].name00 = Bunker[0]["transtitle0" + i]; // pass text
menuData[i].activateFlag = true; // set actveFlag to true
menuData[i].init(); // run init() inside the instance. it adds textfield to the menu_mc and also set name00 as Text for the textField
}[code].........

I want to get "xml00" var from that instance on the stage by mouse click but, trace (evt.target.xml00); is not working .. also trace (evt.target.name00); is not working. I can get everything like .alpha or .text from txt00 but not other variables in my object.

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Use Public Variables Or Public Static Variables?

Feb 4, 2010

is it better to use public variables or public static variables?

View 6 Replies

Flex :: Undefined Public Variables - Value Of MyVar?

Oct 11, 2009

I have a class like this..
public class Doc {
public function Doc():void {}
public var myVar:Boolean;
}
How can I know if the value held by myVar is default false, or someone has assigned false to it? Isn't there an undefined state? How can I achieve such a thing?

View 2 Replies

Actionscript 3 :: Is There Any Advantage To Using Properties Over Public Variables

Jun 14, 2011

This might be a very stupid question, but I have to ask it anyway. I am graduating in about a month and while studying, I have always been taught to use properties instead of public variables. So I started wondering what the advantage was and I must say that in some cases, I have no clue at all. Of course it is handy when some other logic needs to be executed when setting properties or getting properties, but is there any advantage to using properties when you are only getting/setting a variable? An example of what I mean is shown below (As3).

[Code]...

View 2 Replies

ActionScript 3.0 :: Public Variables From Init Space?

Nov 10, 2010

I have a bunch of variables I need to pass to some class from frame where I instance classes. Is there any other way do make Class read that variable values beside this?

Sample:

ActionScript Code:
var _imgPaddingVert:Number  = 2;
var _imgPaddingHor:Number   = 3;
var _minTopMargin:Number    = 30;

[Code].....

View 1 Replies

Actionscript 3.0 :: Access Public Static Variables In A Loaded Swf?

Feb 27, 2009

I'm literally new in AS3 and slowly trying to migrate in thats why im here seeking for help. Can someone help me how to access/control a certain public variable in a loaded swf from the main swf? this problem has been paralyzing me for days. (sigh...) [code]...

View 1 Replies

Actionscript 3 :: Calling Private Functions By Changing Public Variables?

Jun 13, 2010

i've never tried to do this before, so my head a swimming a bit. i'd like to have a public boolean called enabled in myClass custom class. if it's called to be changed, how do i trigger a function from the change? should i add an Event.CHANGE event listener to my variable?

View 1 Replies

ActionScript 3.0 :: Public Class Extends Object

Jul 22, 2010

I'm trying to have a class that is an Object to hold details about the movieclip that it is attached to.

[Code]....

and two others of this nature. I didn't think you had to declare the 'key' of the object as a variable before setting it in the Object. So my guess is that it is angry about the class itself, somehow. (syntax or the like)

View 2 Replies

ActionScript 3.0 :: Public Vars From Object Class In Timeline?

Mar 16, 2012

I've made a Horizontal Bar Class which controls an element in library.So I have:Library: HorizontalBar MC - Using class HorizontalBarThis class has some public vars.Library: ContainerGame MC - Using class ContainerGameWhen I add this element to stage (HorizontalBar) inside ContainerGame MC I want to be able to trace public vars from its class inside ContainerGame.

View 2 Replies

ActionScript 3.0 :: Get InstanceName / Object From MouseEvent.target?

Jun 4, 2009

[Code].....

When Mouse is down on PlanetEarth_mc, only PlanetEarthOuter_mc starts moving, leaving PlanetEarthInner_mc and PlanetInner_txt in the same existing place. I want to call the parent of the target i.e. I want to move PlanetEarth_mc. also, EventReceived.target.parent.startDrag();//Gives Error. How can I achieve that from received MouseEvent Object I hope u understand this.

View 3 Replies

ActionScript 3.0 :: MouseEvent CLICK And DOUBLE_CLICK On Same Object

Jan 8, 2008

how to listen on a SINGLE CLICK as well as DOUBLE CLICK for an object?

Meaning, one behaviour if the object is single clicked and another behaviour if it is double clicked.

Simply adding two event listeners (CLICK and DOUBLE_CLICK) leads to CLICK handler getting called always.

I understand one could start a timer upon the CLICK and if another CLICK doesn't arrive within 'x' milliseconds generate a SINGLE_CLICK event, else generate a DOUBLE_CLICK event. It seems like a hack and dependant on CPU load.

View 14 Replies

Actionscript 3 :: Return An Object With An Update Data, That Is Pass In To A Public Static Function?

Dec 23, 2011

How can I return an object with an update data, that is pass in to a public static function?

GetDate.dayName(MyDate.setDate(1984,3))
//MyDate with new info (year, month) will be pass into GetDate.dayName
package hwang.time

[code].....

View 3 Replies

Actionscript 3.0 :: PV3D - MouseEvent.CLICK On Object Instead Of Face

Feb 10, 2009

I've created 4 cubes, which turn on Rollover and Rollout, and on Click they should move to new x y coordinates.The Rollover and out on the faces (workfront,workback) work fine, but i don't get it right to put the Click on the whole cube.if tried to address it with workcube.addEventListener(MouseEvent.CLICK, workclick); but that doesn't work.if i address it with this or without workcube all my cubes react to the click

Code: Select allvar workcube:Cube = new Cube(new MaterialsList({front:mat2, back:mat3, top:mat0, bottom:mat0, left:mat1, right:mat1}), 60,60,60,10,10,10);
scene.addChild(workcube);

[code]....

View 4 Replies

ActionScript 3.0 :: MouseEvent.CLICK And Visibility Of Sprite Object?

Jun 24, 2009

Here, my loader instance name is: myLoader.  When I click on the dynamically loaded image, I need to place a small red rectangle at that particular pixel position on the image.For creating a small rectangle, I am using following code:

[Code]...

View 2 Replies

Flash :: AS3 MouseEvent.MOUSE_MOVE Event Stops Responding After MouseEvent.CLICK Call?

Nov 6, 2010

I have several stage event handlers to enable mouseovers over several dynamically generated moviecilps on the stage that then change their alpha to indicate the mouse is over that particular mc... fairly trivial (mcOver handler). Additionally, I also want to know what MC is clicked, so I update a public variable (public var activemc:Number) with the ID of the dynamic movieclip when the mouse is over it (using a hitTest to check, which is why the EventListener is added to stage and not to the MC), which is checked in the mcClicked handler:This is in the constructor:

//stage.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);
//stage.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mcOver);[code]....

However, the mouseover behaviour (alpha 0 when over, alpha 1 when out) stops working as soon as I click on any movieclip on the stage, and the mcClicked ID checking (below) stops working completely. I don't know if this is to do with focus:

private function mcClicked(event:MouseEvent):void {
myTextField.text = String(activemc); // activemc is a public var:Number with the movieclip //ID
}

I then tried adding the event handler for the stage mouse_move again and this gets the mouseover working again but only for 1 more click, after which it stops again:

private function mcClicked(event:MouseEvent):void {
myTextField.text = String(activemc); // activemc is a public var:Number with the movieclip //ID
stage.addEventListener(MouseEvent.MOUSE_MOVE, mcOver);

View 1 Replies

ActionScript 3.0 :: Get MouseEvent.ROLL_OVER Or MouseEvent.MOUSE_OVER To Pass Through To MovieClip Underneath

Jul 9, 2009

I have a MovieClip (call it base_mc) which is under a bunch of other MovieClips (call them subclips). The MovieClips on top are all mouseEnabled with MOUSE_OVER, CLICK, etc, event handlers. I want to capture the event of MOUSE_OVER (or ROLL_OVER) on the base_mc as well. Any time I am over one of the subclips I am also over the base_mc clip. How can I capture this event?

View 2 Replies

ActionScript 3.0 :: Flex - Diffrence In MouseEvent.CLICK & MouseEvent.MOUSE_DOWN?

Oct 21, 2010

I'd like to know what is the difference between MouseEvent.CLICK & MouseEvent.MOUSE_DOWN. Because when i use MouseEvent.MOUSE_DOWN for a button to set full-screen view its doesn't work, instead of this MouseEvent.CLICK works. So what was the reason.

View 3 Replies

ActionScript 3.0 :: MouseEvent.MOUSEDOWN Works But MouseEvent.CLICK Doesn't

Nov 6, 2010

I'm making a button for the first time, and I wanted to use a full click to drive it. However, when I use addEventListener(MouseEvent.CLICK, onClickHandler); nothing happens when I click on it. When I use (with the rest of the code being identical) addEventListener(MouseEvent. MOUSE_ down, onClickHandler); it works like a charm.

View 6 Replies

ActionScript 3.0 :: Dragging Object Interfering With MouseEvent.CLICK Function

Oct 3, 2009

I am having a small problem in regards to a click and drag interface I am trying to create.

The user should be able to drag objects around the stage and when desired click to preform an animation.

The problem is that the click to initiate the drag also initiates the click of the animation to play.

I don't really want to make one of the commands a double click as that may feel clunky to some users.

Is there any way to cancel the animation click if the user moves the mouse before letting go?

View 0 Replies

ActionScript 3.0 :: Difference Between MouseEvent.MOUSE_UP And MouseEvent.CLICK?

Apr 7, 2009

What is the difference between MouseEvent.MOUSE_UP and MouseEvent.CLICK? Why should I use one of these over the other? 

Code:myButton_btn.addEventListener(MouseEvent.MOUSE_UP, fNavigate, false, 0, true);
myButton_btn.addEventListener(MouseEvent.CLICK, fNavigate, false, 0, true);

View 3 Replies

Actionscript 3 :: Cancelling MouseEvent.CLICK After MouseEvent.MOUSE-DOWN

Aug 11, 2011

I have a MOUSE_DOWN handler that creates a CLICK event listener on a child object. Naturally, as soon as you release the mouse button, if you happen to be over the child object, the CLICK event fires.I was disappointed to discover that event.stopImmediatePropagation doesn't interrupt the CLICK event from registering the MOUSE_DOWN as part of its detection cycle. It makes sense that it doesn't but still... disappointing.A MouseEvent.CLICK consists of detecting a MOUSE_DOWN on the object and then if it's followed by a MOUSE_UP without leaving the object, he event fires. I had hoped that by cancelling the MOUSE_DOWN event, it would clear that out of the CLICK buffer, but no such potatoes, alas.This could all be handled with a flag and a couple more MOUSE_UP and MOUSE_DOWN handlers, but dang, smacks of effort

View 2 Replies

ActionScript 3.0 :: MouseEvent Target MouseEvent RelatedObject?

Jul 24, 2009

I have the following:
 
rwBtn.addEventListener(MouseEvent.MOUSE_OVER, audioOver);
function audioOver(e:MouseEvent):void
{
var thisClip:MovieClip = e.relatedObject;
thisClip.alpha = 0;
}
 
I would like to change the alpha of the clip that is being rolled over. I don't know how to target the clip that is being rolled over. How do I do that?

View 3 Replies

How To Get A Flash Object (swf) Variables

Sep 14, 2011

I need to know if there's a way (a tool) to get a flash object (swf) variables which are used in "flashvar" tag.

View 2 Replies

ActionScript 3.0 :: Getting Variables From Within An Object?

Feb 19, 2011

There is the code that makes up the major part of the game, and then there is an object for the game board which I kept separate because it required a lot of code of its own to handle pieces on the board, change perspective, and so forth. From the main game code I have no problem accessing information in the game board. I can get the information about an object of apiece on the board, for example, by addressing it astrace(gameBoard.aPieceObjects[x][y].visible) BUT if I want to get information about the main game from the gameBoard object I can't seem to do it. For example, to remove a fog of war I need to know how far a player can see which is information that is kept in the main code in an array of possible players. addressing it as trace(parent.player[i].adVision) gives me an error that there is no such property. The same is true if I use "root" or "this.parent" instead of just "parent".

I know that I could set it in the main game code, but this would mean making duplicate copies of lots of variables which I would prefer not to do. Especially since my program is already not very efficient due to sloppy planning (this is my first real programming project in quite a few years).

View 1 Replies

ActionScript 2.0 :: Variables In An Object?

Apr 24, 2006

how do you access a variable in an object? i have created a subclass of movieclip in but cant access variables in instances of that subclass by using instancename.variable

View 6 Replies

ActionScript 3.0 :: Create Variables On Another Object?

Feb 12, 2012

I'm wondering if it's possible to remotely create variables/properties on another object. Specifically, the stage.

I'd like to do something like this

public var stage.myArray:Array = new Array(1,2,3,4,5);

Perhaps that's not the right syntax. But assuming the array doesn't already exist there, can i create it (from an object that is on the stage)

View 5 Replies

ActionScript 3.0 :: Assign An Object Different Variables

Mar 7, 2012

How do you assign an object different variables.I tried setting it up like this but I get an error.[code]How do you do this correctly I get error Label must be simple identifier when I do it like this.

View 2 Replies

ActionScript 3.0 :: Return All Of An Object's Variables?

Jan 26, 2011

I want to assign an existing Object all the vars of a prototype Object, without a direct reference. One way to do this is:

[Code]...

This way both Object's values for .nom and .age can be independently changed, but it's tedious. Is there an automated way to assign all of protoObject's vars to enObj?

View 9 Replies

ActionScript 3.0 :: Difference Between "$event:MouseEvent" And "e:MouseEvent"?

Jul 28, 2011

What's difference between "$event:MouseEvent" and "e:MouseEvent". What do they do?

View 4 Replies

ActionScript 3.0 :: Adding Variables To A XML Object's Attributes?

Sep 22, 2009

I've created and XML object that's working fine and I want the user to be able to add to the XML dynamically, using an input text field and appendChild() So, what is the syntax to use so that I can put in the text they enter as an attribute of a node of my current XML object? Here's what I've got for adding to the XML (stripped down obviously):

ActionScript Code:
var xmlData:XML = new XML();
var clientToAdd:String = userInput.text;
xmlData.appendChild(<project name=clientToAdd></project>);

How can I take the variable clientToAdd and make it the attribute "name" of the "project" node?

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved