ActionScript 2.0 :: Broadcast An Event From Within Class
Jun 20, 2006
For the Flash application I'm developing, I would like to be able to make custom listeners. I've got a class and want to broadcast an event from within that class. Then I would like to let objects outside of that class listen for these events that the instances of the class will broadcast. First of all, that should be possible right? Then second, how do we do this in Flash? If I try to use broadcastMessage, the compiler complains: There is no method with the name 'broadCastMessage'. The problem is that I would like to let my class broadcast an event, not an object I create at runtime like in the examples.
View 7 Replies
Similar Posts:
Dec 16, 2010
In all the ActionScript examples I come across, people write custom events with the types defined inside the custom event's class definition. But, in my experience, it makes more sense for the object dispatching an event to own its own definition of that event (which, in ActionScript 3, is a String).
[EDIT: After writing this question, I've found there to be cases for both positions -- in some situations, event types should be stored on the event object, and, in others, they should be stored on the object dispatching the event.]
View 2 Replies
Dec 20, 2011
I would like to extends the Event class to add some events I am using in game. But I don't want the new Event Class to have the old public static types. For instance I don't want to have:
NewEventClass.ENTER_FRAME
How do you go about extending the Event class without getting the old types mixed in?
Is there any way to outsmart AS3 to leave out the uneeded types?
Or should I avoid creating a new Event type altogether and just add the new strings?
View 1 Replies
Apr 17, 2007
I'm newish to OOP AS... trying to build a image loader that wipes between loads. having trouble getting my onloadComplete event to call a method in the main body of the class. what am I missing?
[Code]...
View 1 Replies
Sep 3, 2009
Can event listeners only be added to the class which dispatched the event? I ask because I want to have the logic for the listener on the main class, and the action is dispatched on click from a thumb which is instantiated in a scroller class. Kinda like this:
ActionScript Code:
pseudo code:
class main {
main() {
[code]....
This doesn't work. Why can't the main class listen for an event on the thumb class?
View 1 Replies
Jan 7, 2010
how to add an event listener to an event from a custom class. Here are the relevent lines of code (I think) from the class:
[Code]....
View 1 Replies
May 11, 2006
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
Code:
XClassListener.initialize(this);
this.addEventListener("throw", "net.webbymx.game.Player", "wait");
and in my opponent team I can do
Code:
XClassListener.initialize(this);
this.addEventListener("throw", "net.webbymx.game.Player", "seek");
View 4 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
May 7, 2010
How do I listen for a timer event in my document class from another class? im thinking...... HTML Code:
[Code]...
HTML Code: 1119: Access of possibly undefined property gameTimer through a reference with static type Class.
View 3 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
Feb 23, 2011
I want to put protection on the server Because anyone can broadcast I want to put security on the broadcast only Not to receive sound and picture When you use any Flash Media Ankodr when the connection request requests a user name and password either, which does not have a user name and password can not broadcast sound and picture
View 2 Replies
Mar 15, 2010
In Actionscript 3, most events use the capture/target/bubble model, which is pretty popular nowadays:
When an event occurs, it moves through the three phases of the event flow: the capture phase, which flows from the top of the display list hierarchy to the node just before the target node; the target phase, which comprises the target node; and the bubbling phase, which flows from the node subsequent to the target node back up the display list hierarchy.
However, some events, such as the Sprite class's enterFrame event, do not capture OR bubble - you must subscribe directly to the target to detect the event. The documentation refers to these as "broadcast events." I assume this is for performance reasons, since these events will be triggered constantly for each sprite on stage and you don't want to have to deal with all that superfluous event propagation.
I want to dispatch my own broadcast events. I know you can prevent an event from bubbling (Event.bubbles = false), but can you get rid of capture as well?
View 2 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
Feb 18, 2009
In a nutshell I have a custom event that I am dispatching from one class that is not getting picked up by the other class even though i have added the appropriate addEventListener calls on its constructor.Here's how the classes are laid out:
application(class/parent)
- network(class/child)
- loginscreen(class/child)
The constructor of the Application class creates and stores references to the network and loginscreen classes:
ActionScript Code:
import com.fg.managers.NetworkManager;
import com.fg.screens.LoginScreen;[code].....
The NetworkManager class extends the MovieClip class as does the LoginScreen and Application classes as well.Now within the oLoginScreen class I dispatch the ValidateCredentialsEvent by calling it this way:
ActionScript Code:
dispatchEvent (new ValidateCredentialsEvent(ValidateCredentialsEvent.VALIDATE_CREDENTIALS, oLoginData, true, false));
Then when I debug the code, I can step through and see that the ValidateCredentialsEvent is being generated but it is never picked up by the oNetworkManager class whatsoever.Is this occuring because the NetworkManager and LoginScreen classes are children of the Application class and because of this can't capture events raised by one another without using the Application class as the intermediary to redispatch these events? My whole idea here was to create a generic network managing object that could be called from anywhere within the application, by any object, using custom events.
View 9 Replies
Feb 3, 2010
We have implement a DVR solution, but a problem remain how can I split DVR f4v file without loss clients from broadcast?
It's possible to split file if reach a limit such as 40Gb and create a new file without cuts in broadcast?
View 1 Replies
Dec 4, 2010
I have a task before me that I have not spent any time researching in the past because I never thought I would have to do it... I need some specific advice from some of you gurus out there.I need to set up a training facility in which we film a teacher in HD and broadcast it live across the internet to 30 locations around town. I also need to have a live chat going with the video in which any of the viewers can ask a question to the teacher and he/she can answer it in the lecture being given.
The 30 locations that the viewers will be at will be a board room setting with an HDTV on the wall , and maybe a wireless keyboard and mouse that they can share to chat with the teacher.I know I can quickly figure out all of the video stuff, like lighting and cameras. I really need advice on all of the technical stuff that it takes for the live broadcast on the internet.
I imagine that I will choose a content delivery network, but which one? I imagine that I will use Flash Media Server, but which version? Do I need a real time transoding device to feed the analog HD video signals to to feed it to the computer? The company has T1, is it fast enough on the uploading to get what we need done?
View 2 Replies
Dec 17, 2010
I've successfully set up a media server and a live broadcast today. I embedded the swf file into my website and my friends are able to see my broadcast. But my broadcast is only 10M. And the streaming bit rate is 1700. So once the audience is bigger than 6, the broadcast starts to slow down. I've seen on the website that peer-based networking technology can significantly reduce the bandwidth for a single stream, so that the audience can be expanded. Is there any tutorial describing how to implement this? BTW, is there any free VOD/LIVE template available on the net? I would like to encorporate a vod system on my website.
View 1 Replies
Jan 28, 2011
Trying to output to multiple servers - tried launching multiple window of FMLE-but get an error message with the second broadcast attempt.
View 1 Replies
Oct 6, 2009
I am new in action script. I want to develop a application through that i am going to broadcast a video. It will be done by stored file. I have installed the FMS for this purpose but don't know how to configure it. Please help me to implement the video player.
View 0 Replies
May 18, 2009
This is showing up in my logs, and i have no idea what is causing it and can't find any more Dropping application (stream_app/_definst_) message. Clients not allowed to broadcast message. It doesn't happen very often, about once every 1 to 2 days.
View 1 Replies
Jun 10, 2010
I am trying to broadcast live video using a webcam. I am using the developer version of FMS3.0. Actually i have a working code of webcam broadcasting, which i used before. But now i am using a free version of FMS3.0. When i tried to connect, the following error is showing:
"NC.onStatus> info.code: NetConnection.Connect.InvalidAppNC.onStatus> info.code: NetConnection.Connect.Closed"
I am trying to connect with [URL]
View 10 Replies
Apr 12, 2012
HTTP broadcast delay is too long, I do a test in the LAN, send video using FME 3.2 the flow FMS4.5 server, use the sample folder under the videoplayer to play live video streams, using HTTP delay of 10 seconds or more,(RMTP play live rarely delay), who can tell me, how can I do this problem can solve the delay!
View 1 Replies
Nov 24, 2011
I am looking for alt for broadcast live from my webcam.i have option to use Flash Media Server but flash is not supported in ipad so what other option i can go with which support ipad/iphones and other mobile devices as well as web.
View 2 Replies
Dec 28, 2006
I found code which uses a switchboard to switch between a broadcast to the swf player or client side.I want to to have a single connection button(at broadcaster side) that will cut the switcher and enable the broadcaster to connect directly to the client.Im not sure what exactly to change or add inthe current mains code.
(the switcher has only one button[cut_btn]that switches a stream in embedded video [prev_video] which is activated when a broadcaster USERID is selected from a datagrid [broadcasterList_dg]).I want a single connect button in the broadcaster which will do what the switch button does but cut out the clicking of a datagrid and previewing basicly cut off the switcher altogether.
function ncStatus(nsObj) {
trace("NC> " +nsObj.code);
switch(nsObj.code) {[code].....
View 1 Replies
Feb 18, 2011
I have created a class (extends the Event class) for use in one of my projects. If I trace the custom event object in the called function I get 'Event' as the type, but if I trace a TimerEvent, or MouseEvent, etc, I get TimerEvent or MouseEvent... Let me demonstrate:
var c:CustomObject = new CustomObject();
c.addEventListener(CustomEvent.ON_SEND_MESSAGE,fnc);
function fnc(e:CustomEvent) {
[Code].....
View 1 Replies
Jul 14, 2009
I have a class (called Units) that defines sprites which react to mouse events (being dragged around).My main .as class (called Loader) imports the Units class, sets up several shapes from Units as objects into an array (my_array[i] = new Units(j,k,l);) and then calls addChild in a loop to add them to the display list (addChild(my_array[i].shape);).All fine and dandy, but if I want a shape to go to the top of the display list when dragged about, how do I do it? The problem is that the mouseEvent is in the Units.as class, but the addChild is in the Loader.as class.The only thing I can think of is to strip the mouseEvent out of Units.as and add it to Loader.as - but that would mean adding an event to every shape in a loop, which seems inefficient.
View 1 Replies
Jan 6, 2010
I'm making some elearning courses and we are trying to combine semi-automation with the ability to place artwork and content on the timeline. Basically we have a series of small tasks -- read this, click this button, see the result, and so on. We have a "highlight" area component that indicates the area a user is to click. Currently that component dispatches and event from the instance when it is clicked and the main timeline is listening for the event and then moves them ahead to the next task when they have clicked properly.
So the following code:
myClickAreaInstance.addEventListener("clicked",handleClick)
And the handleClick function and removing the listener all has to be handled on the timeline. And for a given task there might be an intro animation and the click area component might not come in until the end. So where to put that code and how to automate it becomes tricky. So I first dug up AsBroadcaster and could use it sort of like Mouse or Key classes.
AsBroadcaster.initialize(ClickArea)
ClickArea.addListener(this);
function clicked(obj){
//handle click broadcast
[Code] .....
Would it be better to us AsBroadcaster or EventDispatcher?
View 1 Replies
Jan 31, 2012
I am developing application with Adobe Flex on AIR platform. Using native extension for Android, it is possible to send SMS from my Flex application. Would it also be possible to receive SMS with my application (receive Broadcast carrying information about incoming SMS)? More generally, is it possible to receive Android Broadcasts in my Flex application?
View 1 Replies
Jul 25, 2010
Is it possible to broadcast a live video stream from my PC to my website and have it appear in a flash player?
View 4 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