i am trying to define a button state class where i can give the class some params and have it load a thumbnail (large files were a previous problem for me on this) that will be displayed upon rollOver. i'm having some troubles with a couple of key points:
1. i don't know how to pass in a reference to a movieClip that i can refer to in order to change its state (x location, for example) 2. i don't know how to send a status message to the host script (main timeline AS code will need to deal with such a message) after the img has been loaded
*both of these would REALLY help me understand some of the mechanics involved with AS2 OO programming,
I'm trying to create an Event Listener used with all buttons placed on the stage rather than a listener for each button object.Are coding examples of a class listener?
Im getting an error whilst trying to add an event listener to a class of a Button on my stage.
1061: Call to a possibly undefined method addEventListener through a reference with static type Class.
On my stage i have a Button with the instance name stopBtn, this is also exported to an actionscript class called classes.stopBtn (stopBtn.as in a folder called 'classes'). The button is on the first keyframe in the main timeline, in a layer with other buttons on that layer
I've done a class to be able to listen to the event for a CLASS not on an instance.
Code: class net.webbymx.events.XClassEventListener {[code]....
why did I do this.It cames with my rugby game.I have player in two teams. When a player throw the ball I want the other teammate to act like "wait for ball" and the opponent like "seek for ball". Plus I'm lazy (and I don't want to register the listener for each instance of the player I'm creating). So this class is made to be able to handle as many instance of a class I want without adding a listener on each of them. I'm just creating a global listener on the class and then I will be able to receive dispatched event for any instance of this class .so in my team I can do
I have a document class called Main.as In the class constructor I have the following listener:
enter code here var listeningFORModeChangeToStudent:Sprite = new Sprite; listeningFORModeChangeToStudent.addEventListener(TellAllModeChangeToStudent.STUDENT,exp); addChild(listeningFORModeChangeToStudent);
[code]....
In a third class I make a call to the despatcher in the previous class:
enter code here var ThisTellAllModeChangeToStudent:TellAllModeChangeToStudent = new TellAllModeChangeToStudent; ThisTellAllModeChangeToStudent.tellAllModeChangeToStudent();
I have trace statements in eveything and from this I know the despatcher in TellAllModeChangeToStudent is being called.The problem is that the listener in the main.as is not calling the function exp.I cant see why and I dont know how to check if the listener is actually seeing the dispatch event?
How do I implement a listener within a class? I am instantiating other objects within side of another class. A sorta parent and child thing. How do I go about making the parent class subscribe to the child class. I want to leave all of the coding at a class level and keep it off of the main timeline.
I want to a listener on a tween on the document class that when it's finished, it goes to it's child's listener function, but I don't know how. I thought it'd just be a case of document.functionName but it's throwing an error.
[Code]...
1061: Call to a possibly undefined method startFade through a reference with static type Class.
Im tring to remake most of my projects that i've created so far in class's and packages but it seems to be a mission.
I have the gameMain_Controls class which is the linkaged to the actually fla. then i have a custom cursor class and a char class the gameMain_Controls pulls objects into the stage as children of the background fron the char class.
now my problem is to get the cursor to hittest of mouse over and at least do a trace out put:
code im trying at the moment which is also in a different class ...called the rollOver_Controls:
if (flap_Control.flap.hitTestObject(Dino_Control.layla)) { trace("lal hit"); }
[Code]....
but the hittest jsut never occurs im guessing the problem is which the location of the object, the container i mean ...but when i try to link it that way i get even more problems
i have a custom class which loads a couple of XMLs. i am creating an instance of this class within another class and i need to know when it is done loading in that parent class so that i can then call a function.
For graphical representation I use fla file as a resource. I work in Flash Builder 4.6 to code. I try to create own class Panel which contains the click event. But event doesn't work when I test the move! When I move the event handler (buttonClick) and event listener to main class (test) and apply the event to the card object (for example), all works fine.
I have instantiated a class (class1) that loads some data via PHP in an AS3 Flex project.I instantiate class1, which is asynchronous and utilizes a URLLoader() to obtain its data.Then I would like to instantiate class2, which needs to USE the data from class1, but when I simply instantiate it I find that class1's instance variable is not populated yet because I am calling class2 too quickly.How can I create such a dependency that will link correctly?I am really new to using listeners, but I am imagining a listener in class2 might be what I need?Or maybe I can pass a reference to the listener in class1 into class2?I also know nothing about dispatching events... is this the key?Here's an example in pseudo code:
var class1:myC1 = new myC1("http://some/url/to/utilize"); //this never shows up because it hasn't loaded at the time i request it trace("the stuff from class1 is: ", class1.myXMLList);
let's say that i have this button which is called "Click_Here" and i added an event listener to it in some class file in order for it to run the event handler in a different one .. so it will be like this
I was trying to make a tank game in which I can move the tanks, let them shoot each other, etc... I insist on creating external classes with Flash Pro cause I am used to OOP language like Java. I created a Tank class which represents all the tanks. Here is the code of this class:
[Code]...
The problem is that the action listener seems never get called when I press any keys. the trace() is not called. But I tried to add a mouse listener just to test and it worked. So I guess its the Keyboard event listener class's problem? Everyone I see on the web uses stage.addEventListener(KeyboardEvent.KEY_DOWN, move) approach.
I'm trying to add an eventListener to a custom class. I created a motion tween in CS4 and exported the motion as as3, which then gave me a chunk of code.I then took that code and turned it into a class. What I'd like to be able to do is set up an event listener in my FLA to listen for when this animation is done playing, however, I have been unable to get that to work. Do I need to add something else to my class? Is there something wrong with how I'm trying to implement the class in my FLA?Here's the code for the class:
What is the best method to add a listener to a movieclip in a class file? I created a loading animation on the main timeline and I tried making it into a class. I can get all the graphics drawn and placed, but can't see to figure out how to add the listener in the class.
and I have the ClassPath pointing to the folder that contains this .as file. I do get the trace "In setUp" but I'm not getting seeing any Keyboard events. There also aren't any errors showing up in output so I am kind of stumped.
What I'd like to do is add an event listener to a class instantiated by my document class that listens for different key presses. So far I can't use stage.addeventListener or I get the null object error so my question is:
a: how do i add an event listener to the stage from another class and b: is it even necessary to add it to the stage , can I listen from that class?
My problem is: I'm trying to create an external class which function is load an external sound file and play or stop depends on stage.activate and stage.deactivate events. The actionscript 3 in the timeline is functioning properly, but when I try to create as external class, it has so many errors. So many that I can't troubleshoot them. Btw, it's my first class creation. Is there anybody who kindly enough to give me some guidance to create a proper class with stage event listener?
I am using a component in my application, but it turns out, it's slowing my app down big time b/c it doesnt remove an eventListener on stage for mouse move. Is there a way I can remove this listener? I can't get into the class b/c it's a component and it doesnt have any sort of kill function to call.
i have got all my public vars for sound class but im having trouble on how i would execute them because i normal would use event listener but its OOP lol so how do you get that functionality ?code in star.as file:
package { import flash.display.MovieClip; public class star extends MovieClip {[code]......
I am wondering if there is a better way to add MOUSE_OVER/MOUSE_OUT listeners to a whole host of objects in my project.
The example is that I am loading in lots of thumbnails for a portfolio viewer. Each thumbnail is an instance of ThumbnailUI Class. Inside ThumbnailUI, I have added both MOUSE_OVER and MOUSE_OUT event listeners. This means that when all of the thumbnail instances are added, I have lots of listeners active at one time. Is this OK? Is there a better way to achieve mouse events on all of these thumbnails?
I am currently having a mc in my library use a class. The mc is duplicated and put on the stage. Inside the class the mc gets a rollover state. Problem is that, although the rollover listener and function 'works', any action that is given is applied to all objects linked to that class.
Code: Select allpublic class cities extends MovieClip { private var theStage:*; public function cities(cityid:int, cityname:String, mymc, ref:*) { theStage=ref; this.alpha=.85; this.buttonMode=true; [Code] .....
So pretty much on rollover on one of the mc's makes them all alpha = 1 and rollout makes them all alpha = .85 instead of the one being rolled over. It does make sense I guess because they are all calling that same function I think. I also tried referring to the specific mc (mymc) instead of the parent and this.
im trying to create a separate class so i can create a custom mouse. But i need to make it so that every time the mouse moves then something happens. as in it dissapers and after 5 seconds the timer resets. I have the code and it works in my .fla file, but im not sure its possible to put it in a class file and have it be the class of the .fla.
I'm trying to dispatch a custom event. So that my main document class can react when a nav button is clicked.I have a navbutton class which creates the dispatch's the event... and is handled by the onNavigate Method...
This onNavigate method works perfectly.... however when I try to create a listener in my main document class I don't "hear" the event.Here's part of the code from the main doc class...here's where I register the listener
this.addEventListener("NAVIGATE", doSomething);
here's where I should handle it...
private function doSomething(e:Event) { trace(e.target.name); trace(e.target._label.text);
I wanted to remove an event listener from main class stage, but i get the error 1120: Access of undefined property stage. How do I actually access the stage?
custom class:
import main; main.disableVcam();
main class:
public static function disableVcam():void { trace("disable"); stage.removeEventListener(MouseEvent.MOUSE_MOVE, movevC); }
I'm having an issue with an event dispatcher and an event listener. Here is the application code... Code: Select allpackage { import flash.display.MovieClip; import flash.events.*; import flash.net.URLVariables; import SendAndLoad; public class Test extends MovieClip { [Code] .....
It will trace the loader.data variables but doesn't dispatch the event to the main application (Test). I'm listening for the event on the stage of the main but it doesn't trigger the event to display that the login has been successful even though it traces from the sendAndLoad class...