ActionScript 3.0 :: Access Object Functions From Another Object?
Jan 18, 2011
So I have two movie clips linked with classes- one with the class "theList" and one with the class "challengeBar". I need to use a function in challengeBar to access a function in the theList. They are both immediate children of the stage.so for now I have this (in the challengeBar class)-
public function populate(){
this.textBox1.text = myList.dequeue();
}
should it be something along the lines of root.myList.dequeue? or stage.myList.dequeue? How can I access that function?
View 2 Replies
Similar Posts:
Jan 7, 2010
I am developing an application with Flex for the GUI and Restlet for the webservices. I have a strange problem. I put my XML as a property on a generic object, and send it as part of a POST request. But in the Restlet webservice, this XML is irretrievable. How do I retrieve it? I tried initialising the received Representation object to a DomRepresentation, but thats not working. If I put the received Representation object into a Form object, then getFirstValue is returning that XML as a string! I noticed that the contentType of the HTTPService was application/www-form-encoded so I set it to application/xml and its not helping either. I use restlet 2.0m6 and here is the code snippet that I use -
[Code]...
View 1 Replies
Jul 23, 2011
i am trying to access an object within a class and the object is comming up as null but i dont understand why.
this is the object:
btnLMain = new MovieClip(); //variable declared earlier in code
btnLMain.name = "btnLMain";
[Code].....
View 2 Replies
Jul 23, 2011
i am trying to access an object within a class and the object is comming up as null but i dont understand why.this is the object:
btnLMain = new MovieClip(); //variable declared earlier in code
btnLMain.name = "btnLMain";
btnLMain.clickNum = 0;
addChild(btnLMain);
this was created in the class: LanguageButton. here is how i declared the above class within the class i am trying to instantiate it:
var btnL:LanguageButton;
then i try to access the btnLMain from the LanguageButton Class and it, (btnLMain) is comming out null:
btnL = new LanguageButton(cssLoader);
main.addChild(btnL);
btnL.btnLMain.addEventListener(MouseEvent.CLICK, btnLClick);
View 2 Replies
May 31, 2009
I have problem with accessing object created by function imported from another package.
I have 2 packages DragDrop and UserInterface. In UserInterface I create methods for buttons and later add them in DragDrop . I make it in two different ways:
One(this one works):
[Code]....
View 6 Replies
Jun 22, 2010
I'm trying to set up a menu. Because this menu can have a varying number of entries, I'm generating it instead of hard-coding it. The Menu object contains an Array of MenuEntry objects, and each MenuEntry has a framework.Button object which contains the text and box that actually gets drawn to the screen. I can add a MouseEvent.Click event to the Button, but not the MenuEntry. If I do it that way, though, I'm unable to access the data in the MenuEntry object that contains the button, so I don't know which MenuEntry was clicked.
The only solution I can think of involves checking the mouse position against the position of each MenuEntry, depending on the number of Menu Entries. This does not seem like the right way to do it, though, as it is not scalable. I tried having the MenuEntry class extend the Button class, so theoretically, the MenuEntry itself could dispatch mouse click events, but that didn't work.
View 1 Replies
Oct 20, 2010
It's too complicate to explain but I'll give you an example
I have an AS3 ResultEvent Object and this object has several propeties which can be accessed by this like:event.result.name or event.result.age and, I have this String variable: eventProperty:String that contains "name" or "age" How do I access to event.result. with the variable?
View 2 Replies
Nov 24, 2011
I have an object on stage that when I want to click it start to move cross the stage. But I get error:"Scene 1, Layer 'Layer 1', Frame 1, Line 41136: Incorrect number of arguments. Expected 1."
function animate(evt:MouseEvent)
{
animate1();
[code]......
View 2 Replies
Mar 26, 2009
is there a way in action to group to object so when one object is drag across the screen the other object sticks with it, im using flash btw
View 6 Replies
Mar 25, 2010
So I have this Photo class than handles loading a pic, and dispatches an event when the loading is done with:[code]which is simple and works, but now I'd like to make something more advanced. I'd like to dispatch the load ratio.So far I have extended the Event class, with my own EventRatio class, and I can put properties on that class. Which is cool, but I need something more dynamic than just sending a fixed value.So, what is the best way to connect the Loader object of the Photo object, with the EventRatio object?
View 5 Replies
Dec 18, 2009
I would like to know how to create an object-orientated functions in Actionscript 2. I'm actually not sure if that is what it's called...Anyway here's an example of how I want to be able to call my functions[code]...
View 2 Replies
Aug 4, 2009
I'm new to the object oriented stuff and I'm trying to learn how it works. Here's what I've started on - it's led to a few dilemmas. I have one flash file and two .as each with one class. In the timeline of the fla file, it reads:
ActionScript Code:
var FileObject:ScriptFile = new ScriptFile();
function onEnterFrame(){
FileObject.CallInput();
}
Call input is a function in "ScriptFile.as" that calls another function in "Input.as";
ActionScript Code:
class Input{
public function Input(){
} public function keyListener(target:Number):Number{
[Code] .....
In output, when I press Left, it will say -5 over and over again, and I'm trying to add to xpos value but that isn't happening.
View 1 Replies
Feb 9, 2010
I've got this external class that I'm loading into a function, it traces. But then I try to use the already loaded class in another function it tells me that I'm trying to access something that's not defined[code]...
View 0 Replies
Mar 26, 2009
OK, so I have code making a new graphics item and calling it sliderBar:
Code:
var sliderBar:Shape = new Shape();
sliderBar.graphics.lineStyle(2,0xFFFFFF,1,true);
[code].....
View 4 Replies
Jan 12, 2006
Been doing some actionscript magic lately, done a nice interpolator class. The class, whenever an update occurs, calls a previously specified callback function. Normally, setting a variable of funCallback:Function and calling it works fine. However when I wanted to specify an *object's method* as the callback for the interpolator, it apparently called it as if it would be a static method.
And it isn't.What I need to do, simply speaking, is to be able to call an object's public method, having just th object's reference and function name, just like the second variant of setInterval does ( the one having "object, string" as the first two params, not "function").
View 12 Replies
Jun 16, 2011
I have this situation where i'm trying to save "chat logs" while people switch around views in my flex mobile application..so, my plan is i'm starting out with a main object that I plan to re-use as the main chat log object..I call it textObjso, when someone new wants to chat my plan is to make a new object with the persons username.so how if i were to get the username from something like data.username how could I translate that into the var name of the object I want to make? So in the end i end up with.[code]
View 2 Replies
Jan 8, 2011
how i can stop the movement of one object when one other object is over one third object
View 1 Replies
Mar 12, 2012
I have tried for days to solve this. I am trying to access the "newsData" object from my .fla to populate my manually created textfields.
Here is the class:
package {
import com.adobe.serialization.json.JSON;
import flash.net.URLLoader;
import flash.net.URLRequest;
[code]....
View 9 Replies
May 4, 2011
In order to have accees to the parsed XML does all my code that needs access to it have to be within the displayResources function?? I'm trying to load some XML outside f the function and it aint workinnnnn.
XMLParser.load("Q_data/string_assets/string01.xml", onFinish, null, false, true)
function onFinish($success:Boolean, $parsedObject:Object, $xml:XML) { //This function gets called as soon as the XML loads and gets parsed. if ($success)
[Code]....
View 5 Replies
Feb 4, 2012
I have a circle as movieclip in the settings and a fex controlls (up,down,left,right).I dropped all controlls and the circle and press on a button to add some actionscript.[code]When i click on the controll nothing happen.
View 2 Replies
Jul 29, 2009
In FFishScript:
function customObject () {
this.property = 123;
this.getProperty = function() {return(this.property)}
}
[Code]...
What is the best way to access FS object from Actionscript?
View 1 Replies
Aug 4, 2009
I have MCs loaded from the Fla library through my main class. These are drag objects. When one of these is clicked, I want the player to run a function that will disables some based on one selected. When I tried the obvious reference, I had an error. I've been advised to add these to an array, but I can't even do that.
Code:
import HO_42;
I set the objet to a variable above the constructor function:
Code:
private var office:HO_42;
The constructor calls a function that loads the objects to the stage (and this works fine if I don't try to access the object), here is an example of the load and access code:
Code:
office = new HO_42();
addChild(office);
office.x = 441.9;
[code].....
View 16 Replies
May 28, 2010
I have an object, and I want to access it's property, but I'm passing the name dynamically... so instead of referencing person1Properties I'm trying to reference ("person"+id+"Properties)...
[Code].....
View 7 Replies
Aug 18, 2009
I try to access to the class of an Actionscript Object like the method getClass() in java.
example :
I have this class with a method 'myMethod(clazz:Class)'
public class Class2
{
...
public function myMethod(clazz:Class):void
[Code].....
View 3 Replies
Jul 29, 2009
I have an object, myObj, that has no key/value pairs, only elements. When i trace it out i get the elements listed inbetween curly braces {item1, item2, item3, item4} I can access the first element by calling myObj.first( ) and I guess there are other methods I could try to call on the object - such as myObj.last( ) - but I can't seem to access the other elements in the object. I would like to be able to do something like:
[Code]...
View 5 Replies
Jun 27, 2010
Anyone know how to access a var name dynamically with an object? I need to be able to get myObject.objValue1. But I want to go through a whole bunch of them in a for loop from value 1 to 50.
View 1 Replies
Oct 7, 2010
how to access data from object I instance on stage?Inside class XmlParser I have function that parse some XML:
ActionScript Code:
package src
{
import flash.events.Event;
[code]...
And I instance object on stage using:
ActionScript Code:
var xmlInstance:XmlParser = new XmlParser(xmlData, 0);
trace (xmlInstance);
//trace outputs [object XmlParser]
I`d like to access data in holdXml variable from stage.
View 9 Replies
Jan 11, 2012
So ive made a custom message system for my game and the scrollpane component requires me to have the info inside one movieclip. I have a couple of textfields there that i want to change to some variables on demand. The vars are in an external as file and im able to reference them well on the main timeline. The problem is when im inside the scrollable object, all the vars return blank instead. This is the code which is placed inside the object:
Code:
import Variables;
var variables:Variables = new Variables();
function setMsgSlot (e:Event) {
[Code]....
View 0 Replies
Aug 17, 2009
I have a class whose primary purpose is to create and manage other classes in my game. One of its variables is an int that keeps track of the players money. It is also creating towers which are objects of their own. However the tower classes that it creates need to have a way of accessing the money integer (so they know if the player has funds for upgrading them)
View 3 Replies
May 20, 2010
i have a movie clip in my library which has a text box inside it , and it is Exported for Action Script , with a name "MenuItem"and i am creating objects in my AS file like ..
menuItem = new MenuItem();
menuItem.menuLabel.text ="i am object 1";
addChild (menuItem)
[code].....
View 4 Replies