ActionScript 3.0 :: Create A Stop Video Event Listener?
Jul 6, 2011
I have created a music site with audio and video content in AS 3. So far my audio content works well, and my video content works well. Video continues playing when the home or music buttons are clicked. I am having trouble locating code for an event listener that will stop video play when the home button or music button are clicked. Here's what I have been trying so far...to no avail.
stop();
home_btn2.addEventListener(MouseEvent.CLICK, goHome2);
function goHome2(E:MouseEvent):void {
I have built a flash movie that is located here: http:[url]......For some reason after the timeline plays through completly (after the "headshots and potfolios" slide) the listener on the "child and family portraits" button stops listening or responding. Why is that? All the other event listeners are behaving themselves except this one? Here is the actionscript:
I am currently using a mouse move event listener to check the x and y coordinates of the mouse on the stage, but I am wondering how in god's name I can stop this once the function has exited. I am using the even listener inside of a drag and drop function, specifically inside of the drag function, but when I call dragging.stop(), I would also like to remove the event listener.
I am trying to figure out how to get an enterframe event listener to stop. I created a simple example below, where a line spins around on stage until the user clicks on it. When they click on it, the user should be jumped to frame 2.
so i have an event listener a mouse click in a movie clip name "em_contact" i also have an event listener after an animation plays out on an object called contactbtn_mc, How do i tell Flash once em_contact is clicked dont listen for that event any more?
my code is below em_contact.addEventListener(MouseEvent.CLICK,gotocontactanimation); function gotocontactanimation(EvntObj:MouseEvent):void {
What object do I add my Mouse event listener to in order to capture clicks on a video? I've tried the netsream object and the video player object, but I don't get anything with either. Is this even possible?
Is it possible to create a custom event listener other than the ones prebuilt in flash? I sort of know my way around the eventDispatcher class, but can I use it to create my own event to listen for?
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?
Can I create a single event listener for all mouse events ?
my understanding is no because: what's happening is that each listener is checking for a string in an event and comparing it for a match against a list which is the listener.
I'm having trouble getting the Video class to work.. Everything works fine until I try to add an on enter frame event listener to the movie. I basically want to overlay an effect that gets updated every frame but adding the event listener causes the movie to freeze before it loads or on the first frame or just shortly after starting play back.. Check out the source code at [URL]
It freezes even if the enter frame method body is commented out so I don't think it's because of extra overhead..
The fastforward and rewind buttons on the FLV Playback components don't work like normal ones. If you've tried to use them you'll notice that they respond to a click event rather than a mouse_down event.
By taking apart one of the skins I've found that the fast forward movie clip is forward_mc.
How do I create an event listener for the buttons inside the FLV Playback Component?
If the instance of my FLV Playback component is called "movie," how do I access it? I've tried this, but it doesn't work:
I thought I had a handle on the timer class (even just a beginners understanding), but I'm having trouble with it.I have an event listener for the timer and it starts fine i get a delay, then a tween,but when I place a myTimer.stop();in the fuction the listener called (to stop it) it dosent stop.it will repeat placing the first image, and then call the first function again
......Wait its placing the first image in (a couple of lines before the start), so Its restarting the whole movie, not just the function?
myTimer.addEventListener(TimerEvent.TIMER, tweenone) myTimer.start(); function tweenone (event:Event):void[code]...........
TypeError: Error #2007: Parameter listener must be non-null.at flash.events::EventDispatcher/removeEventListener() at project1_fla::MainTimeline/btnName()
Alright, I've looked online at a bunch of different collision tutorials but they don't explain what I'm looking for. I want object A to hit object B and then execute a function via to a Event listener.
There seems to be tutorials on starting the next video at completion of the previous one using the FLV2.5 Playback component, but stopping a video playback event when a new one is triggered. Ex. Video one button is clicked and video starts playing, viewer clicks video two button mid way through playback of video one and starts video two. How do I stop the playback of video one when video two button is clicked to avoid both playing simultaneously?
I am trying to work with the EventDispatcher class to dispatch a custom event to stop a video from playing. The video plays inside a MovieClip with an attached class file called PlayerProfile. I want the video in the PlayerProfile MovieClip to stop playing when the user clicks on another MovieClip called ScrollBox. I'm getting no compile or runtime erros, but the code is not stopping the video. I have seen use of a public static constant to represent the custom event. Is that what I am missing here.
I am trying to learn JavaScript and I am wondering whether JavaScript has a event listener just like ActionScript's ENTER_FRAME. Basically, I want this event listener to listen "all the time" not just wait for any particular instance (mouse click, keyboard event) of event.
if I have an event listerner (mouse, keyboard, enterframe,....event) that is being triggered, and when it finishes its event, something that is able to detect the finished event listener and fire out another sets of event.
It works more like MOTION_FINISH in TweenEvent, but it is only available for TweenEvent only, what if I want to detect a mousclick, keyboard, enterframe or even touch event?
My stage has about 25 buttons on it. Each button when pressed to tweens the background to some random x/y coordinates and then loads an external swf file.This is all working, but the timing is off. How can I wait for the initial background tween to end before I make the loader call to the .swf file.Currently each button's behavior is called on the MouseEvent.CLICK event which calls a function that knows its unique filename.swf. I know you can add the MOTION_FINISH even to the tween event but then I would have to call a new function and lose track of the button that initially called it.
I'm moving on to my next massive programming project and I'm trying to decide whether I should code it in as 2.0 or 3.0. I came across the new click event model in 3.0. Right now it's looking like a pain in the butt to me. So now I have to make a function and add it as an event listener? what the hell? What's the benefit? I understand stuff like this makes AS a more complete language but it's kinda annoying.
This is a very basic question but I can't seem to find an answer. I have a mouse over event and have created the buttons with the mouse overs which is working great. I created the actionscript to go to a specific web page when a user clicks the button. Now, I need to add a label to the mouse over so when someone mouse's over any area of the button, it will show them a particular name for the button.
I am sure that this can be done using actionscript in a mouse event roll over command but I can't figure out what I need to show the text. Here is where I am:
how can i access event.target outside event listener method.say for example
my_mc.addEventListener(MouseEvent.CLICK, onC); function onC(e:MouseEvent):void { var m:MovieClip = e.target as MovieClip; } trace(m.totalframes);/// not working
now what if i want to get totalframe property of m instance, in short for every movieClip clicked.
I am doing this inside a module containing viewstacks and their childs.Calling onInit() on creationComplete of module.When I am inside one of the childs of a viewstack of this module and press Enter, it doesnt not invoke the listener function at all (bp inside this does not get hit).
private function onInit():void{ this.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed); }[code]..........
This might be more of a subjective question, but is it generally best practice to have one dedicated method per event-types that you add an event-listener?
Such as:
myButton.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); myButton.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut); //Somewhere else in the code...
[Code].....
And if you had a MouseEvent.MOUSE_UP, MouseEvent.MOUSE_DOWN and other relevant MouseEvents event-listeners to watch for, you could even set a switch statement to handle all the various MouseEvent types.
I have these buttons in a movie clip and I would like to have only one event listener for the parent, using event.target to point to the children. I have also tried event.currentTarget, and it didn't work.here is the code that works:
I have a code in AS3 that works when you rollover it. I need to use the same code but not with an eventlistener for a mouse event but a frame event when the timeline plays the clip
var coordX:Number = shaker_mc.x;var coordY:Number = shaker_mc.y;var timer:Timer = new Timer(10); shaker_mc.buttonMode = false; shaker_mc.addEventListener(MouseEvent.MOUSE_OVER,startShake);shaker_mc.addEventListener(Mous