ActionScript 3.0 :: Null Event Targets When Using Addlistener On Classes

Oct 31, 2010

I'm not sure why my event targets are missing when I add an event listeners to my button classes. So when I try to check which button has been clicked I can't tell a difference between them. Does anyone know what could be causing this? Everything else looks like it's coming through okay.[code]...

View 1 Replies


Similar Posts:


ActionScript 3.0 :: [object Class] Instead Of [object MovieClip] - Delete The Targets ENTER_FRAME Event?

Mar 15, 2009

When I use MouseEvent.MOUSE_OUT the target is [object MovieClip], but when I use MouseEvent.ROLL_OUT I get [object Bildspel] - and Bildspel is my class. The thing is that when I use ROLL_OUT I'm not able to delete the targets ENTER_FRAME event.

[Code]...

View 2 Replies

ActionScript 3.0 :: Communicating Between Classes - TypeError: Error #1009: Cannot Access A Property Or Method Of A Null Object Reference

Oct 12, 2009

I have this error when I run the files.

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.common::stageConfig()
at cloudsMain()
CloudsMain.as which is attached to the .fla

[code]....

Basically I'm trying to create a class that I can call and centralise any mc on stage by eg.stageConfig.centralisedDO(my_mc), However I encounter the above error.

View 2 Replies

ActionScript 3.0 :: Set An Event Dispatcher To Null?

Nov 5, 2011

If I have an event listener which picks up an event, how can I remove the event dispatcher? I would be looking for something like this.

Code:
addEventListener(MouseEvent.CLICK, onClick, true);
function onClick(event:MouseEvent):void
{
event.target = null;
}

View 3 Replies

Removing Event Listeners And Null Objects?

May 14, 2009

I was just wondering--and it's probably an obvious question really--if I make an object null and that object had one or more event listeners registered, are the listeners removed?

for example:

Actionscript Code:

object.addEventListener(Event.SOME_EVENT,callBack);
function callBack(evt:Event):void
{
object = null;

[Code].....

In this case have I removed 'object''s listener when I made the object null?

View 1 Replies

ActionScript 3.0 :: Add Event Listeners Between Classes?

Mar 11, 2009

So I've gotten into using my own as Classes, and have an interesting question.
My main swf calls a php script that gets data from a mysql database which is returned as XML. Part of that data that is retrieved is a filepath to a jpg image. It then takes that filepath and other information, and passes it to my external class, the "news story" class.

All fine and good. Then, the "news story" class uses a loader to load that image along with some text, organize it, and voila, you've got your own very pretty "news story". (I'm extending the MovieClip class here, though I suppose it doesnt matter)

Now, my main swf uses this component to load multiple of these "news stories". The problem is, theres that load time for the image. The main swf is loading them all one at a time, because they are putting each one together on their own.

The key here is that it be dynamic. So, since we don't know how much text is in each "news story", we also therefore don't know it's height. What I'm doing is creating each story in the main swf, pushing it into a "news story" array, adding an event listener to each ones' loader, and when the event listener is triggered, I want it to go to the 'add content' function where it sets the news story's Y value based off the position and height of the previous story that was added (stacking them, obviously). This makes sense, because otherwise it'd add them all on top of each other and it'd be a jumbled mess.

The problem is, the event listener is on the loader object INSIDE the component actionscript. So, how do I figure out which news story to set the Y value for? Because the eventlistener is listening to the loader, not the class. I hope this makes sense AT ALL. Here is the code:

Quote:

while (fancy shmantzy conditions)
{
/*creates the news story and passes xml data to it (filepath, etc)*/
storyBlock = new StoryBlock(a bunch of parameters);
subCBArray.push(storyBlock); //array that stores each news story info

[Code]....

View 2 Replies

ActionScript 3.0 :: Event Not Being Heard Between Classes?

Feb 1, 2011

I seem to have run in to an issue where a custom event is not being heard between objects.  Here is my set up: I have two classes, GameBoard and InstructionsBoard, each is linked in the library, in the properties panel as a class to movieclips on the stage.

I dispatch an event from my GameBaord class: dispatchEvent(new CustomEvent(CustomEvent.ANIMATION_DONE));

and Listen for it in my InstructionsBoard Class:

[Code]...

View 4 Replies

ActionScript 2.0 :: Event Listening Between Classes?

Jul 10, 2009

I am an AS3 coder, but I've been given project that needs to be done in AS2, and am having trouble understanding the events model. Inside my controller movie clip, I have a draggable movie clip that dispatches an event when it reaches a point. I cannot for the life of me figure out how to get my controller to properly listen to the event.

The dragger dispatches the event as follows:

Code:
var eventObject:Object = {target:this, type:'Snapped'};
dispatchEvent(eventObject);
Controller script--the complete handler never executes

[Code]....

View 1 Replies

Flex :: TextArea Component Is Null On ApplicationComplete Event

Jun 11, 2010

I have a weird issue (weird because it is specific to one component) with applicationComplete in a fairly simple application. All the UI components are declared in MXML. I can access them all in applicationComplete, but not a spark.components.TextArea component, named taStatus here; it is null in the handler.[code]...

View 1 Replies

Flash - FocusEvent.FOCUS_OUT Event's RelatedObject Always Null?

Apr 15, 2011

I'm trying to code a drop-down control in as3, where clicking on the control's 'top-text' (a Sprite) causes a box to appear (another Sprite). The box contains a list of all items that may be selected. When 'item1' is selected the box closes and item1-text becomes the control's top-text. And so on.I also want the box to automatically close when the control loses focus, i.e. when the user clicks anywhere else on the flash movie. For this, I add an event listener on the box for FocusEvent.FOCUS_OUT.

The thing is, I want different processing to take place depending on the FocusEvent's relatedObject. To be more precise I want to do something more than just closing in the specific case where relatedObject is a child of the drop-down control itself. And just close it if not.My problem is that the relatedObject property is always coming up null no matter what gains focus. Furthermore the isRelatedObjectInaccessible property is always false so (according to the documentation) it is not a security related problem.

View 2 Replies

ActionScript 2.0 :: No Method With The Name 'addListener'

Sep 22, 2004

I have one script which is working a treat ( using ASBroadcasters ) and then today, I copied and pasted the same script into a new site and whenever I try to register a listener, I get the dreaded "There is no method with the name addListener"... oh, and a few things. the broadcasting object is a class extending the XML class, and i have used the same script before with no issues the listening object extends the object class, and whilst this class has been freshly developed, the last time I used the ASBroadcaster methods I didn't have to extend anything for it to work.

View 2 Replies

ActionScript 2.0 :: No Method With The Name 'addListener'?

Sep 22, 2004

I have one script which is working a treat ( using ASBroadcasters )and then today, I copied and pasted the same script into a new site and whenever I try to register a listener, I get the dreaded "There is no method with the name addListener"...

the broadcasting object is a class extending the XML class, and i have used the same script before with no issues the listening object extends the object class, and whilst this class has been freshly developed, the last time I used the ASBroadcaster methods I didn't have to extend anything for it to work...

View 2 Replies

ActionScript 3.0 :: Communicating Between Classes - Dispatching Event?

May 30, 2010

I'm just starting to build my first proper OOP piece.I have on stage two manually placed MCs.One is viewer_mc:ViewerClass and one is menu_mc:MenuClass.They each have their own class and there is a document class...

PHP Code:

package
{
import flash.display.*;[code]....

So I can call the public method of either class from the other class.However, I am now trying to understand custom events and dispatching them with parameters.which uses a custom event class.This works fine when the dispatchevent and listener are both in the viewer class, but when the dispatchevent is in the viewer class, and the listener is in the menu class I can't get it to work.I suppose for my purposes I don't really need to use the custom event class, I can just call the respective classes' public functions but I just wanted to try and understand how it works.Here's the pared down version of menu class...

PHP Code:
package classes {
import flash.display.*;
//some other imports[code].........

View 4 Replies

ActionScript 3.0 :: How To Turn Off Event Listeners In Other Classes

Apr 18, 2011

Two buttons, left and right, move the (full screen) backgrounds. If you click the right arrow, the current background moves left, the new background is added to the right, is also moved left, and the old background is faded out. Think of it as a long stream of backgrounds, being moved back and forth with the previously viewed one being faded out with a tween.

The problem is that the arrows appear too soon, and clicking one breaks the whole thing. Main.as adds the arrows & adds the event listeners which then call the functions. The Main.as functions to move the backgrounds use background.moveLeft(); in the backgrounds class, which is where the fade out tweens happen.

So - how do I turn OFF the buttons (added in Main.as) when the tween (in background.as) has finished? I've tried using something like "getNextRoom.addEventListener(TweenEvent.MOTION_FIN ISH, turnOff);" with turnOff referencing the arrows, but it complains that they don't exist (and in the backgrounds class they don't).

View 11 Replies

ActionScript 3.0 :: Listen To A Custom Event In Various Classes At Same?

Jul 17, 2011

I'm using a electronic device to dispatch events within AS3.
 
short explanation: -->

Think of these events as a KeyboardEvent.My point is to dispatch an Event (like a Key that is being pressed) so I can listen to this event on EVERY Class I need to.I'm not sure how to instantiate or listen to these events correctly =/
 
I mean: I want to be able to listen to the key that is been pressed as if that was a global event every Class can receive...
 
long explanation: --> I'm doing something like this:

1) created a (main) Class that extends a Sprite.

2) created a class (KeyboardInput) that extends the main class.

3) created a class (KeyMap) that extends EventDispatcher.

4) created a class (HomeScreen) that extends a Sprite.
 
 My FLA file is associated to the KeyboardInput Class.This Class creates a listener for the KEY_DOWN KeyboardEvent and instantiate the KeyMap Class that dispatches a CustomEvent:
 
stage.addEventListener(KeyboardEvent.KEY_DOWN,function(evt:KeyboardEve nt):void { keymap = new KeyMap(); keymap.setKey(String.fromCharCode(e.charCode)) });[code].....

View 3 Replies

ActionScript 3.0 :: Event Flow Between Non-DisplayObject Classes

Feb 7, 2009

What is the proper OOP method of communicating between classes that are not on the display list?

For example: The Document class instantiates a new class just for loading in different XML files. This XmlLoading class should let the document class know when the xml has been loaded and parsed so that the interface can be built out.

From my understanding, events can only be listened to and dispatched through the display list, but since there is nothing visual with this xml loader, it doesn't make sense to me to make this class extend a sprite and add it as a child of the document class.

View 5 Replies

ActionScript 3.0 :: How To Detect Custom Event In Classes

Oct 17, 2010

I am learning how to do a custom event in AS3. I can do an event in a class but I dont know how to detect events in other classes. I want to detect in main.as an event reached in class player. E.g., a variable reached a value 4 in class payer and dispatches an event so main.as can detect it. This doesn't give an error but my code doesnt output I can deect an event in main from classplayer.

//main
myplayer=new ClassPlayer();
myplayer.addEventListener("image_loaded",imageLoad edHandler,false,0,true);
myplayer.addEventListener ("watcher_loaded",watcher_loadedHandler,false,0,tr ue);
addChild( myplayer);
[Code] .....

View 3 Replies

ActionScript 2.0 :: Create Event Handlers For Classes?

Mar 29, 2005

how can I create event handler for a class that I wrote myself?

Example:

Code:
class blah {
var ladida:string;
function blah () {

[Code]....

How is it possible to create an event handler, like lame.onChange? When the variable inside the class is changed, how would i be notified?

View 5 Replies

ActionScript 3.0 :: Loader Content Null After Event.COMPLETE Fires?

May 7, 2008

I have an array of loaders loading .jpgs. After the Event.COMPLETE fires, I trace the content at the current page and it tells me the content is null, BUT on testing the images appear just fine. Here's my code:

Code:
for (var i:uint = 0; i<pages.length; i++){
pages[i].contentLoaderInfo.addEventListener( Event.COMPLETE, loadImg, false, 0, true );

[code].....

View 1 Replies

ActionScript 2.0 :: Difference Between AddListener And AddEventListener?

Apr 17, 2006

I was using addEventListener("change",myListener) and it was working fine, then I thought of trying addListener instead, but then it didn't work. This lead me to google search what addListener does.I saw some stuff that made me conclude that there is a "listener" and there is an "event" and there's a difference between them. The Key object as 2 listeners: onKeyUp and onKeyDown , but none of the components have listeners, they just have events.I wanted to know why, and whats the difference between a listener and an event, and the difference between addListener and addEventListener.

View 8 Replies

ActionScript 3.0 :: ScrollPane AddListener For ScrollEvent?

Jan 10, 2011

I have a swf which just consist of one image per frame. I want to use the scrollpane's verical scrollbar to run through the frames instead of running along the height of the swf.Is there a built-in support, straight forward way to do this?Otherwise, I might want to use a ScrollEvent listener + callback to gotoAndStop according to the ScrollPane.verticalScrollPosition.

View 2 Replies

ActionScript 3.0 :: Variable Referencing Between Classes And Custom Event?

Nov 5, 2009

I finally got the variable referencing between classes and custom event problems sorted out. Now I got a question regarding the Error #2044 and Error #2035. The error reads like this:

Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.

I've put all the swf in the same directory, so I don't think that is the problem. Could it be that my XML file is in another directory that's causing the problem? I also heard having quotes in the URL in the XML file could also be problematic. Is that true? Here are my AS and my XML file.
[code]......

View 12 Replies

Flex :: Event-based Interaction Between Two Custom Classes?

May 25, 2010

I have 2 custom components, which have their own nesting hierarchy ... One is container for another. I have to "familiarize them" with each other. The way I'm trying to achieve that is using global events (one side is firing and the other one is catching):

Application.application.addEventListener("Hello", function (data:Event):void{
// .. some actions
});

[Code]...

Then should be created the connection between container and it's child.

BUT, the only thing I could acheive is passing a reference to the Container in the DynamicEvent. Is there any chance that I could access the child at the event-handler function.

View 3 Replies

ActionScript 3.0 :: Create Separate Classes For Custom Event?

Aug 3, 2007

I'm still struggling with the complete concept of custom event handling within AS3. I know I am close to a complete understanding it's just not falling into place yet.[code]...

View 6 Replies

ActionScript 3.0 :: Event Listeners For MCs On Stage And External Classes?

Nov 6, 2010

I found this code for a contact form at msinghinteractive easy-to-use-flash-as3-contact-us-form-class and it dynamically creates input fields and buttons. I didnt like the dynamically drawn submit and reset buttons, so I added my own MCs(my 'buttons') to the stage. I tried modifying the code and took out the dynamically drawn buttons..However, I cant figure out how to add Event Listeners to the buttons which exist on the stage--Im getting undefined errors...The fla is directly associated to a main.as class which just determines the parameters of the .as class it is tied to -to set the size of the Contact form.This is the entire class:

Code:
package{
import classes.*;
import flash.display.*;

[code]....

where btn is the instance name of my submit button MC.My problem is that because my buttons exist on the stage I dont know how to add Event listeners within that class---or rather doing that doesnt work because the listeners are throwing that undefined property errors--I gave them instance names...

View 7 Replies

ActionScript 2.0 :: 2 Classes - Make Them To Comunicate With Custom Event.?

Nov 13, 2008

You have some examples of how works custom events in as2? If I have 2 classes that extends movie clip, how can I make them to comunicate with custom event.?

View 1 Replies

ActionScript 3.0 :: Flash Event.target.name In External Classes?

Aug 3, 2011

How do I call this function for multiple listeners without IDE timeline and frame names, using external classes? Im moving my timeline code to classes, and Im stuck with this..

View 4 Replies

ActionScript 3.0 :: Dose This Encompass All Manner Of Display,net And Event Classes

Dec 27, 2009

Dose this encompass all manner of display,net and event classes

import flash.display.*;
import flash.net.*;
import flash.event.*;

View 1 Replies

AddListener For External Playback Flv (when Loading = Mc.visible)

Dec 9, 2009

I am importing 4 videos flv with playback component. When a video is loading, I would like an mc to be visible (like a loading mc e.g.youtube) to be sure the users understands that it's working and loading. But when it starts to play, the mc needs to disappear.

So I imagine something like this code is a start (it doesnt work but it can maybe help to illustrate what I want to do);

import fl.video.VideoEvent;
vid1.addEventListener(VideoEvent.LOADING.videoLoad );
function videoLoad(e:VideoEvent){

[Code].....

View 1 Replies

ActionScript 2.0 :: Key.addListener Only Registering Cetain Key Presses?

Feb 13, 2009

I have built an application in Flash 8 (as2) it has key listeners in it which work when run from Flash 8.When I open the application in CS3 and run it from there the key listeners no longer work. On testing I found that it only registers when pressing w u d g x and the numbers.

View 0 Replies







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