ActionScript 3.0 :: EventDispatcher Class To Dispatch A Custom Event To Stop A Video From Playing
Nov 11, 2009
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.
[Code]...
View 1 Replies
Similar Posts:
Nov 23, 2009
What I want to do is to dispatch the click event when the component is clicked. (The class is essentially some text in a textfield that needs to be able to do certain things, and it needs to be able to respond to a click). Sounds easy enough... I want the event dispatched when that portion of the text is clicked. But uh...how? it's not like a button where I can just go myButton.addEventListener(MouseEvent.CLICK, myClickHandler);That's clear, because some component is going to be listening for the Click event dispatched when myButton is clicked. It is built into the AS3 framework that a button knows how to listen for a click event.
After the import statements I've got:[Event(name="click" type="mx.events.Event")]How do I dispatch the event when the component is clicked, when the component doesn't yet know how to respond to a click event? I've tried adding an event listener in the textfield which contains this custom class of text, but nothing's happening because the Click event hasn't been dispatched.
View 3 Replies
Apr 7, 2011
I have a custom event that is dispatched when a slider is moved but I receive no event from inherited dispatcher class I created whereas I followed the same syntax as solution for My flash custom event doesn't trigger
[Code]...
View 4 Replies
Feb 3, 2010
I need to send a signal from my class BasicVideo.as, to my main class Main.as.
BasicVideo.as extends (and needs to extend) Sprite.
So, how can I dispatch an event from that class to the main class without extending EventDispatcher?
View 1 Replies
Apr 1, 2011
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?
View 1 Replies
Apr 20, 2011
I want to dispatch a custom event from the Country() sto the MenuButton();[code]When a country is hovered a custom event is dispatched which I want the MenuButton to listen and if the parameter passed is the same as its name to get highlighted. The Country Class is the Base Class for my countries movieclips I have on stage and the MenuButton the Base Class for the menu button.
View 1 Replies
Apr 1, 2010
I have a sprite A which has a child, sprite B.Sprite B has a variable, instance of class C which only extends EventDispatcherIn class C, I dispatch a custom Event. The eventlistener in sprite B reacts on the event.The same eventlistener in class A doesn't respond.If I dispatch the same custom event in the eventhandler in class / sprite B, this event is seen in class / sprite A.Is there a difference in events going through the displaylist and those who are from an EventDispatcher?
View 6 Replies
Apr 8, 2011
I dispatch a custom event from an event dispatcher (following solution Inherited a class from EventDispatcher in Flash but custom event not received) and I add a listener in both dispatcher itself and in main. trace shows that only dispatcher receives this event not main. How to make main also receive the event?[code]
View 2 Replies
Apr 12, 2009
I am having trouble using a custom event in flex. I need to dispatch an event from inside two nested components and receive it in the main application file. The basic set up is a main application file importing a custom "gallery" component.
[Code]..
View 1 Replies
Dec 8, 2011
In my AIR application, I try to dispatch a custom event from a class to main window.This class is use to call httpservice. My goal is to send a custom window when the httpservice result is send.[code]...
View 1 Replies
May 14, 2011
how to dispatch custom event in flex in my main mxml file i have put this code to dispatch this function
[Code]....
i want to ask what i am missing why my customevents not working
View 2 Replies
Jun 24, 2010
I'm looking off of this site: [URL]
Followed it closely and still nothing! I dispatch the Event alright from the first .as file and it runs the function featEvent() but that's as far as it gets. (found this out using trace statements)
Custom Event:
ActionScript Code:
package asFiles {
import flash.events.Event;
[Code].....
I believe the error is in the actual featEvent, but can't find where.
View 7 Replies
Apr 23, 2011
I have a main document class with an eventListener detecting a custom event.
The custom event exists in multiple swfs. Its task is to call a function which will remove a movieclip in the document class.
This is working in the loaded swf, but not in any loaded swf afterward.
Do I need to write the dispatchEvent differently if its trying to send an event that has been sent already?
I hope this isn't too vague without code examples. It would take me quite a while to extract the relevant code.
View 2 Replies
Apr 7, 2009
I have some problem with custom event dispatch, I have a main class call main.as, which will call in another class call something.as, when something.as is called it will dispatch an event. i have added an eventListener for that particular event, but it's not working.
[Code]...
View 5 Replies
Apr 7, 2011
My prog here doesn't work there's no syntax error My flash custom event doesn't trigger
so my question is can flash object dispatch custom event to itself because that's what I wanna do ?
View 1 Replies
May 27, 2011
I got a question about event dispatching and dispatching in flex.
My goal is to pass an email address captured in one component (Comp1) and be passed to another (Comp2). These two components are navigator content of a viewstack. The custom event dispatched the email correctly from Comp1 but somehow could not reach Comp2. The application (Main) looks like :
<fx:Script>
<![CDATA[
import events.LoginEventComplete;
[Code].....
View 2 Replies
Nov 10, 2011
I am trying to get some code working from an example I came across. most of the functionality works but it is failing when it tries to dispatch a custom event. At the moment the code that is trying to dispatch the event is inside a class that handles amf remoting.the example has this line in it for the dispatch:
Application.application.dispatchEvent(new
RemoteResultEvent(RemoteResultEvent.USER_UPDATE_COMPLETE,"test"));
but that fails as it does not know what application.application is "Multiple markers at this line:
-Access of undefined property application"
I assume that this is because this was not written for a mobile app. I tried changing the dispatcher to EventDispatcher
EventDispatcher(
new RemoteResultEvent(RemoteResultEvent.USER_UPDATE_COMPLETE, "worked"));
but I then get this error:
TypeError: Error #1034: Type Coercion failed: cannot convert events::RemoteResultEvent@18337731 to flash.events.EventDispatcher.
This is the code in the custom event RemoteResultEvent.as :
package events
{
import flash.events.Event;
public class RemoteResultEvent extends Event {
[code]...
View 1 Replies
Jan 21, 2010
Is there a better way of doing this?
Code:
var b:someButton = new someButton();
b.addEventListener(MouseEvent.CLICK, dispatchEvent, false, 0, true);
[code]....
View 1 Replies
Sep 20, 2011
I have a boxer class that I would like to be able to dispatch a custom event out of at different times so the main timeline can pick it up and do something. It is at the end of different things. ie. movieclip finished playing. So far when I try to dispatchEvent it says I can't with error 1061.
View 8 Replies
Oct 20, 2009
Is it possible to dispatch event from class that isnt extended class of MovieClip? I created my own class and put import flash.events.Event; import flash.events.*; but when i call dispatchEvent compiler throws error:"1180: Call to a possibly undefined method dispatchEvent."
View 3 Replies
Jan 2, 2010
I have an <mx:Application> which contains a <mx:Module>. This module has several child modules. It also has some an instance of a class I have created. I am trying to have a method of this class dispatch an event that can be "heard" by the module and handled. This isn't happening.To be more clear, I am using 'dispatchEvent' to from inside a class method.There is an instance of this class in: mx.core.Application.myapplication.mymodule.myclassIt is the 'myclass.somefunction' that dispatches the event. I have a listener registered in 'mymodule'. Nothing happens when the function/method runs, however.
View 1 Replies
Dec 28, 2009
Is there a point of creating custom event class if i dont need to pass custom property with that event?
View 3 Replies
Mar 23, 2011
I am trying to dispatch a custom event from one flex module to another.The code which dispatch the event is as below Application.application.Destination.child.dispatchEvent(
new AlgoEvent(AlgoEvent.GETFROMPARENT_LOCAL_EVENT));
here AlgoEvent is a custom event.on the other side the module which catches and handles the event has this code:
public function sendParametersToChild(e:AlgoEvent):void
{[ code]...
but when the statement Application.application.Destination.child.dispatchEvent(new AlgoEvent(AlgoEvent.GETFROMPARENT_LOCAL_EVENT)); is executed the debugger give the following run time exception:
TypeError: Error #1034: Type Coercion failed: cannot convert resources.events:: AlgoEvent@4182239 to resources.events.AlgoEvent.at flash.events::EventDispatcher/dispatchEventFunction()[code]...........
View 7 Replies
Nov 6, 2009
I have a class which makes a url request and stores data from that request. When the data is retrieved, parsed, and stored into an array, I'm sending a dispatch event which I listen for in my document class. In the event handler function in the document class, I'm accessing the array that was compiled from the class. The array inside the class has 15 values, however in my event handler function, I'm only retrieving one value from it, which is the last value in the array. I posted my code below. Is there a different way I'm supposed to use the dispatchEvent in order to retrieve all of the array values instead of one?
Class
package com.src
{
import flash.display.Sprite;
[Code].....
View 1 Replies
Feb 21, 2010
I have small chess application which consists of cells and boards. When user moves an item to the board, I want the board cell to dispatch an event so Board can listen to it and call a listener[code]...
View 3 Replies
Apr 6, 2009
I don't know if i've been in front of my computer for too long, but I can't for the life of me understand why this doesn't work:
All i'm trying to do is dispatch an event from one class to the other, when I trace it out, it says the event is getting added, but the event listener isn't picking anything up.
[Code]...
View 5 Replies
Dec 21, 2010
dispatch event video tutorial...
View 2 Replies
Jun 27, 2011
I am trying to dispatch an event of CustomEvent class
[Code]...
View 1 Replies
Aug 12, 2008
I have 3 files.
main.fla
PHP Code:
import classes.LevelObj;
var newLevel:LevelObj = new LevelObj();
var levelListener:Object = new Object();
levelListener.onLoaded = function(oEvent:Object) {
[Code] .....
Now this runs great but in the loadLevel function of LevelObj.as, when I receive the event from the GBXML class that it has finished loading I want to call another function within the same class (LevelObj) to continue with further processing the XML data. What I make of it, is that I am still within the scope of the myListener object. Should I use a Delegate function here to get to the function within the LevelObj scope?And how about properties from the LevelObj scope? When doing a simple trace of some testVar I get undefined. Logical ofcourse because it is not within the same scope. But I am stuck here.
This is the part that should contain the call to the function..
PHP Code:
myListener.onLoaded = function(oEvent:Object):Void {
trace("LevelObj.XObj > "+oEvent.success);
if (oEvent.success) {
trace(testVar); //CALL FUNCTION HERE IN SCOPE OF LevelObj
} else {
View 1 Replies
Jan 27, 2009
How can I detect when a FLV video is ended in order to dispatch an event?
View 3 Replies