ActionScript 3.0 :: MouseEvent Listeners Not Firing - But No Errors

Jul 31, 2009

The problem is with addAnimation()

ActionScript Code:
package
{
import flash.display.MovieClip;

[Code].....

... then it works.

But I don't want the movieclip on the root like that, I want it within main.page1

View 3 Replies


Similar Posts:


Flash :: Why Are Event Listeners Firing More Than Once

Jun 14, 2010

In my Flash project I have a movieclip that has 2 keyframes. Both frames contain 1 movieclip each.

frame 1 - Landing
frame 2 - Game

The flow of the application is simple:

User arrives on landing page (frame 1) User clicks "start game" button User is brought to the game page (frame 2) When the game is over, the user can press a "play again" button which brings them back to step 1

Both Landing and Game movieclips are linked to separate classes that define event listeners. The problem is that when I end up back at step 1 after playing the game, the Game event listeners fire twice for their respective event. And if I go through the process a third time, the event listeners fire three times for every event. This keeps happening, so if I loop through the application flow 7 times, the event listeners fire seven times. I don't understand why this is happening because on frame 1, the Game movieclip (and I would assume its related class instance) does not exist - but I'm clearly missing something here.

I've run into this problem in other projects too, and tried fixing it by first checking if the event listeners existed and only defining them if they didn't, but I ended up with unexpected results that didn't really solve the problem.

View 2 Replies

Flex :: Event Listeners Not Firing In Code

May 15, 2011

event listeners not firing in this code can anybody guide me what is problem with this code.[code]

View 2 Replies

Flex :: Programmatically Firing Event Listeners

Nov 10, 2011

I would like to programatically fire an event on a spark checkbox. I have a tab bar which has tabs enabled according to various checkboxes. I am loading data into these tabs. Sometimes tabs 1 and 2 will be enabled. Other times tabs 2 and 3. Other times tab 4 by itself (and all the other combinations). I have tried to enable the VBox (in action script) which is in my view stack but it seems to freeze the application. The VBox enables correctly upon user input on the check box. If I set the checkbox to be selected it does not fire the event and so does not enable the tab.

Is it possible to manually fire an event in Flex. I have tried to see if I can take the checkbox and get the event and fire it. Unfortunately I can only see addEventListener, hasEventLister and removeEventListener. There is no way of getting the events that are already on the checkbox

View 1 Replies

ActionScript 3.0 :: Why Are Functions With Event Listeners Firing Themselves Again

Aug 23, 2009

I've had this glitch for a long time, and I've tried several ways to get rid of it, and now that I just recoded everything to see if it was something I did, it's back again! basically, whenever I press space (regardless of whether or not I am listening for a space press [or any key press]), the last function fired by an event listener will run itself again, with the exact same arguments supplied to it in the first time.

For example, if I make a simple button to trace("text"); and take you to another frame. Once you get to that frame you can press Space and it'll trace "text" again! I really have no idea what's causing this, and it doesn't seem to be happening to me in new files. and there's too much code to show you, but I just want to know if anyone has heard of this before or if they have any theories to what's going on.

View 7 Replies

ActionScript 3.0 :: Event Listeners Not Firing Consistently?

Oct 7, 2009

I have 9 buttons on my site which I wish to increase to 100% alpha when the users mouse rolls over each one, then have the alpha reduced to the original setting of 75% on rollout.If I set the code below for 1 button it works just fine. However, if I repeat this code just changing the numbers for each button, it stops working once duplicated more than a couple of times.Why does it stop working and how can I write this efficiently so it works for all 9 buttons?

Here is the code:-
addtocart1_btn.addEventListener(MouseEvent.MOUSE_O VER, fadeinaddtocart1);
function fadeinaddtocart1(event:Event):void

[code]......

View 3 Replies

ActionScript 3.0 :: Keyboard Event Listeners Not Firing?

Nov 17, 2009

It currently has the following listeners active. When you click a blurb, you will zoom into it. When you click it again (or anywhere on the flash object) it will zoom back out.If you let it idle it will zoom in and out at roughly 10second intervals.There are also keyboard functions that when you click on the arrow keys it will move the camera in various ways. The keys only work in the zoomed out state and are disabled on zoom inThe problem that I'm having is with these. On startup, the keys work fine. If you let it idle and have it automatically zoom in then out, the keys will work fine. However, if you manually click out of a blurb, the keyboard event listeners stop working. I'm not sure why this happens since both the auto-zoom and the manual zoom both call the same function to zoom out.

At first it seems to be that the window is losing focus, since if I click on white space I can use the keyboard again. The problem though, is that when I use an DEACTIVATE event listener to test it, it doesn't show the flash object losing focus. Because of that, I'm not really sure how I would go about fixing this problem.

Code:
package com.jonchau.twitter {
import flash.display.MovieClip;

[code]......

View 1 Replies

ActionScript 3.0 :: Remove MouseEvent Listeners If Navigate Away From The Frame?

Feb 9, 2010

I've got a project I'm working on that has two frames in the main timeline and on the second frame there is a movieclip (pages_mc) with 7 frames to it, each containing content (more movieclips, text, graphics, etc).  I set it up this way because I have a title bar and navigation buttons on the main timeline I want to always stay on top of everything.If I have actionscript on an individual frame of pages_mc, that controls buttons on that frame, do I need to remove the MouseEvent listeners if the user navigates to a different frame?  I've read that if you don't remove them it will eat up memory and cause poor performance.

I already ran into a problem with the ENTER_FRAME event listener, in which I was forced to remove it because it would just keep going even when the user navigated to a different frame of the pages_mc movieclip.Just didn't know how much of a problem this would be.  I'm thinking that if I don't remove them, every time the user goes back to that frame it's just adding another MouseEvent listener to the buttons.  Is that correct?

View 3 Replies

ActionScript 3.0 :: Sending Additional Information To MouseEvent Listeners?

Feb 15, 2009

I have a series of identical buttons. I want each one to delete a certain item from an array.But the function that deletes the item from an Array is obviously also the MouseEvent function that the listener looks at, which to my knowledge can only take one parameter.

View 5 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 :: 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

ActionScript 2.0 :: Component Listeners - Write Out The Code For The Listeners?

Jul 24, 2004

I have two components in my movie,how to write out the code for the listeners.Is it possible to write one listener that listens for changes in both components or do I have to write a separate listener for each? How would this look like written out?

View 1 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 :: Difference Between "$event:MouseEvent" And "event=MouseEvent"?

Jul 27, 2011

What does "$" means in actionscript 3? What's the difference between "$event:MouseEvent" and "event=MouseEvent"?

View 2 Replies

ActionScript 3.0 :: Why Isn't This Timer Firing

Oct 4, 2010

here's the code.
 
var zipTimer:Timer = new Timer(1000, zipArray.length-1);
zipTimer.addEventListener(TimerEvent.TIMER, onTick);
zipTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);

[code]....
 
Now, I can't see, for the life of me, why this isn't firing. It's almost exactly the code from Adobe's docs...zipArray.length is at least 32.

View 1 Replies

ActionScript 3.0 :: HitTestObject Firing More Than Once

Dec 15, 2011

I'm working on a scene where the user can drag sugar, honey and syrup flavour to a cup of coffee and each time they collide, the coffee's happiness is increased by 1. I added a TweenLite so that sending any of the objects to their original positions is much more fluid. The problem is that the hitTestObject is now firing more than once (which makes sense and now happiness is increasing at more than one increment at a time) but how can I make it so happiness is increased just once?

Code:
public function hitsDecaf(e:Event):void{
if (myCounter.myHoney.hitTestObject(myCounter.decafSweetened)){
ifStartTimer = true;
stopDrag();
myCounter.steamHappy.gotoAndPlay(2);
[Code] .....

View 4 Replies

ActionScript 3.0 :: FullscreenEvent Not Firing?

Jan 24, 2008

I have the following:A document class, extending from a custom class, extending from MovieClip. In my document class, I assign a handler to the FullScreenEvent like so:

Code:
addEventListener(FullScreenEvent.FULL_SCREEN, function(e) { toggle_fullscreen(); });

Also, I've set up a SimpleButton to call that same function, toggle_fullscreen, when clicked.Here's the catch:When I click the button, my app goes fullscreen. When I press Esc, the app goes back to normal but the FullScreenEvent doesn't get fired,so I can't catch it to re-align the elements on my stage.I've also tried to add the event listener to the stage object of my document class, but that doesn't work either.

View 4 Replies

ActionScript 3.0 :: KEY_UP Not Always Firing?

Sep 20, 2010

The problem is that I've done a lot of work in my game, and there's too much code bound to shift and control keys. For example you need to hold shift key to select multiple soldiers or control key to shoot or sometimes pause the game or even call a map, a lot of stuff in GUI depends on those keys as well. Both KEY_UP and KEY_DOWN are added to the stage object. But, time after time, there happens a very annoying thing, KEY_UP event just doesn't fire for shift or control (in most cases it does, but not always). That is, I press shift, start selecting soldiers, then release shift but Flash Player keeps thinking it's still pressed, so I can still select multiple soldiers, which is not good.

I found the exact same problem here: [URL]

View 6 Replies

ActionScript 3.0 :: Event.ID3 Firing Twice Instead Of Once?

Jan 19, 2010

I have some code where an event handler listening to Event.ID3 fires twice for an MP3 file. From searching the web, I found a few others asking a similar question, but I haven't seen any response.

Does anybody know what would cause the ID3 Event to fire twice for a single file? My only guess is that the MP3 file contains two versions of ID3 format.

The code looks like this:

Code:

var mySound:Sound;
function setup()
{

[Code]...

View 2 Replies

ActionScript 3.0 :: URLLoader Only Firing At 100%??

Feb 14, 2010

I am having a problem with my ProgressEvent.PROGRESS handler. It looks like this:

Code:
function handleProgress( event:ProgressEvent ):void {
var percent:Number = Math.round( event.bytesLoaded / event.bytesTotal * 100 );
trace("Uploading %" + percent);
}

It just traces "Uploading %100" every time

I am using a big file so I know its taking several seconds between calling URLLoader.load and complete. There just doesn't seem to be a report in between 0-100..

View 12 Replies

ActionScript 3.0 :: Events Firing Before Listener Is Set

Nov 18, 2009

I keep running into problems where I want to add an event listener onto a class instance RIGHT after it's instantiated, like this:
Code:
storiesXML = new XML(XMLdata);
storyBook = new vStories(XML(storiesXML.stories));
storyBook.addEventListener("storyBookLoaded", storyBookLoaded);
. . .

But by the time we arrive at the third line, the "storyBookLoaded" event has very often (inconsistent) already been dispatched from my class instance:
Code:
var evt:Event = new Event("storyBookLoaded", true, false);
dispatchEvent( evt );
...

(Even though quite a lot has happened in the class before that.) To be clear, I don't want to add storyBook as a display child, and even if I did, the addChild() method would have to be called after instantiation of storyBook, so we'd have the same problem. I know I could set a timer in the vStories class to artificially delay the dispatching of the event, but that seems really hack-ish, and would have a real compounding problem if I have to do it too often as everything builds up. How to make sure custom communication events happen after their listeners are set?

View 4 Replies

ActionScript 3.0 :: Timer Event Not Firing?

Jul 13, 2010

I have a little flash app that I have running constantly on my server (I made it an exe). It runs great for a few days, but then eventually it just stops.

Code:
trace("test1");
var myTimer:Timer = new Timer(5000, 1);
myTimer.addEventListener(TimerEvent.TIMER, getData,false,0,true);

[Code].....

The code above should call the function getData once after 5 seconds have passed. This works 99.99% of the time, but for some reason (usually after a few days of it running) it doesn't call the getData function.

I have verified this through trace statements. When it eventually fails, it traces out test1, test2..... then nothing else. No test3.

I'm assuming I need to add an event listener for the timer object to check if it fails for whatever reason. How do I do this?

View 4 Replies

ActionScript 3.0 :: Event.COMPLETE Isn't Firing

Sep 21, 2009

Can anyone see why my event.Complete isn't firing

[Code]...

View 4 Replies

ActionScript 3.0 :: Event.COMPLETE Not Firing On PNG?

Dec 5, 2009

I'm sure some users on this forum will be aware that AddThis are dropping the Clearspring Launchpad, so I'm writing a new API to get ready for the changeover. Part of that is a base UI that will create buttons for social network sharing destinations. At the moment, AddThis contain all the icons in a single long strip that is 16x3520 pixels in size [URL]...
 
What I'm trying to do is load this into a utility class, but the Event.COMPLETE event never fires, and if the Loader class that loads it is added to the stage, the bitmap is never shown. I thought it was maybe a dimensions issue, but what is curious is that if I place the PNG on a Flash stage and export as a SWF, it loads no problem. If I dump it out as a JPEG, no problem. Its ONLY when the file is a PNG that there are problems trying to load it. I even tried dropping it out as a 24-bit PNG (the original is 8) but that had no effect.

View 2 Replies

NavigateToURL Not Firing When Site Viewed On Mac

Oct 28, 2010

I am simply trying to link a button on my site to another webpage (an online store). The site is currently live at Higdon Florist (won't let me put the dot com address due to forum rules) The last 2 menu options (View Bouquets and Place Order) should link to (store dot higdon florist)

On PC, this works just fine every time.

However, I have reports that Mac users have trouble. The action never fires on the first 4 or 5 tries. Then, suddenly, it begins to work (and continues to work thereafter).

My AS3:

import flash.net.URLRequest;
import flash.net.navigateToURL;
navigateToURL(new URLRequest("(store address)"), "_self");

[Code]....

View 4 Replies







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