Actionscript 3 :: Does It Make Sense To Dispatch Events From Another Object

Oct 7, 2009

I'm still trying to get my head around the best way to structure event flows. Someone made a lot of sense by telling me that contained objects should be decoupled from their parent containers so they're reusable between containers. Instead of calling their parent's function, they dispatch an event. Sensible! I recently myself in the awkward-feeling situation of dispatching an event on a contained object, from its parent. It seems more intuitive for an object to be the one dispatching its own events. Maybe I'm bordering on breaking the Law of Demeter? Example of what I'm doing: child.dispatchEvent(new ChildEvent(ChildEvent.IM_BEING_A_CHILD)); Am I correct in feeling strange here, or is it a normal thing for one object to dispatch another object's events?

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Null Object Reference That Makes No Sense

Sep 5, 2010

My problem is that I listen for a mouse down event and when that occurs I add a new instance of a certain object to the stage, pushing it also to an array:

[Code]...

var minDist:Number = particleA.width / 3 + particleB.width / 3; When I trace the both elements, it says that the particleB is null, what is correct, because If I remove the snippet responsible for creating those, no error pops out. why it's null?

View 1 Replies

Flex :: Video Or VideoDisplay When Does It Make Sense To Use One Or The Other

Nov 19, 2009

Flex appears to have 2 video classes: Video and VideoDisplay. My question is when does it make sense to use one or the other?

What I can tell from initial glancing is that VideoDisplay responds to mouse events because it inherits from IntaractiveObject, but I'm not sure if it's a real difference, because Video seems to have a workaround for this in that you can add your own event listeners.

There's probably more to it, but this is the only difference I can see now. So my question for those who used these objects extensively, can you share your experience when you use one over the other.

View 1 Replies

Flex :: Dispatch Events Between Two AdvancedDataGrids

Aug 20, 2010

I have two separate advancedDataGrid instances (let's call them A and B). What I'd like to do: when clicking on grid A. I'd like:
for grid A to handle the click normally (i.e. default advancedDataGrid behavior)
for grid B to receive a click event a certain location and handle such event using advancedDataGrid default behavior (i.e. without having to write a handler for such click).

I've managed to dispatchEvent a MouseEvent.CLICK to grid B and to handle such event by creating an event listener, but really I'd like for grid B to handle the event on its own (i.e. without having to re-rewrite a handler), and that doesn't seem to be the case. Is MouseEvent.CLICK even the right event?

View 1 Replies

ActionScript 3.0 :: Possible To Dispatch Events Across Packages?

Aug 25, 2009

I'm having problems with dispatching an Event across packages, I have a video player and when clicking the next button it dispatches an event to my EventManager class then I have another class in a different package listening for it but nothing executes the event listener.[code]...

View 5 Replies

ActionScript 3.0 :: Dispatch Events On TextField

May 12, 2010

I'm trying to manually dispatch events on a textfield so I can manipulate it indirectly via code (e.g. place cursor at a given set of x/y coordinates). However, my events seem to have no effect.[code]...

View 0 Replies

ActionScript 3.0 :: Dispatch Custom Events?

Mar 14, 2011

I have this Document class:


ActionScript Code:
package  {
import flash.display.MovieClip;[code]....

I just want to dispatch that custom event named "myEvent" but it doesn't work. How can I do? I don't want to use flash events. I want to use mine.

View 8 Replies

ActionScript 3.0 :: Loader Won't Dispatch Events?

Mar 2, 2009

I have a loader loading a JPG (which works) but it will not fire any event, neither Event.COMPLETE nor ProgressEvent.PROGRESS - it looks like:

Code:
var url:URLRequest = new URLRequest('klein.jpg');
var ldr:Loader = new Loader();
ldr.load(url);

[Code]....

View 11 Replies

ActionScript 3.0 :: How To Dispatch Custom Events

Nov 24, 2009

i have been trying to figure our the dispatchEvent system in as3. But am just not able to wrap my head around it. So can someone please explain and give me an example on how to dispatch custom events?

for eg: Here i just want to disptach event every 100ms and the event should give me the value of "a" .

Code:
package com
{
import flash.utils.Timer;

[Code].....

View 4 Replies

Flex :: Mockolate : Dispatch Binding Events?

Nov 8, 2010

Is it possible to ask Mockolate to dispatch binding events?For example, given this class:

class Person {
[Bindable][code].....

View 1 Replies

AS3 :: Dispatch Events To Objects Not Related On The Display List?

Nov 18, 2009

So, events bubble up the display list. That's great if that's what you want. But what if you have objects on the stage that are not related that need to listen for events from each other? A simplified example:

var objA = new ObjA;
addChild(objA);
var objB = new ObjB;

[Code]....

Object B can listen for events dispatched by object C. But I also need object A to listen for events dispatched by object C. Also, these objects are created in different classes so I can't hard code references to each other.

View 3 Replies

Flex :: Dispatch Custom Events From A Created Class?

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

Java :: Why Are Events Typically Created At The Time Of Dispatch

Dec 16, 2010

It seems more efficient to store events on the dispatcher if they're never going to change. Isn't creating them costly? Is there some kind of information I'm losing if I dispatch an already-stored event?

View 1 Replies

ActionScript 3.0 :: Make Events For Focusing On An Object?

Apr 15, 2009

I'm trying to make a scrolling slideshow (as long as the mouse is on top of the the obj1, obj2 will move up).

What is the event that will allow me to do that? Mouse_Up will only be activated if the obj1 is clicked =(.

obj1.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
function mouseMove(event:MouseEvent){
obj2.y-=1;
}

View 4 Replies

Actionscript :: Spark.components.VideoDisplay And Doesn't Dispatch DoubleClick-Events

Aug 2, 2010

I stumbled upon and interesting problem concerning spark's VideoDisplay-Component. It seems that it doesn't dispatch DoubleClick-Events. For better understanding look at the following code:

[Code]....

The Click-Event works for both components. But the DoubleClick-Event is only handled by the Panel-Component.

View 1 Replies

ActionScript 2.0 :: Find Alternatives But The Event System Doesn't Dispatch Events?

Mar 26, 2007

I noticed that the Object.watch and Object.unwatch methods are gone in actionscript 3.

I've tried to find alternatives but the event system doesn't dispatch events when properties change, There is a data binding system but I think that's just for Flex.

Does anyone know what (if any) the alternative is?

View 1 Replies

ActionScript 2.0 :: Collapsing Navigation - Make The Main Button Not Sense The Rollovers Of The Internal Buttons

Feb 3, 2005

My problem that I'm having is I am trying to build a menu consisting 3 buttons, side by side that open and reveal subnavigation buttons on rollover. Then on rollout of the main container button, they close back to where they were. I have built the buttons and everything works great, the only problem is that on rollover of the internal buttons, the main button senses this as a roll out and plays the rollout animation event (closes the button). How can I make the main button not sense the rollovers of the internal buttons and only play the rollout event on rollout of the main button?

View 2 Replies

Actionscript 3 :: Create A Separate Class For Each MC Inside Of The Container To Listen For And To Dispatch Events?

May 25, 2011

Imagine you have a MC used as a container for several other MC's used as buttons.Now, should I use the class of the container to listen for and to dispatch events. OrShould I create a seperate class for each MC inside of the container to listen for and to dispatch events.

In summary: One class for all, or several smaller classes dedicated to their respective MC.How far should one go with abstraction?.

View 2 Replies

Actionscript 3 :: SWFAddress Change Event, Dispatch Object?

Sep 17, 2010

Is there a way to dispatch a SWFAdresss CHANGE Event but also pass parameters (an Object) along with it?I see something like that in the documentation but I can't find an example online...

View 1 Replies

Actionscript 3 :: Flash Object Dispatch Custom Event To Itself?

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

ActionScript 3.0 :: Dispatch An Event From A Static, Non-display Object Class

Aug 23, 2009

I have a SendData class that sends form info to a php script. It is a static class that does not extend anything.

I want to be able to dispatch an event if there is an error, or when it gets info back from the server. I have a custom event class that I have been using to dispatch events like this, but I have only used that in displayObject extended classes.

The problem is, it seems like something has to be a displayObject based class to dispatch events. I know there must be a way to do this, but I'm having trouble finding it in searches.

View 2 Replies

Flex :: Make TextArea Dispatch An Event Each Time A New Line Is Taken?

Nov 1, 2010

Every time a user takes a new line (i.e each time they press the return/enter key) when typing in a textArea, I would like the textArea to dispatch an event.I can then listen for this event and then carry out some processing on the textArea's contents.

View 2 Replies

Actionscript 3 :: What Is The Sense Of Flex Modules

Jul 20, 2011

As far as my understanding goes Modules kann be used to split an Application into different parts. A big advantage seems to be to be able to load Module after Application Start, to get a better Startup performance. I personally would like Modules to make me able to have an own Code Sandbox for the Module Code. So neither the Main App Code nor the Module Code should influence each other. But for examples CSS Styles from modules influence the Main Application an visa vers. My Question:

1. What can I use Modules for beside Runtimeloading ?

2. Are there options to run code in an own sandbox ? For Example via Loading swf assets ?

View 2 Replies

ActionScript 1/2 :: Text Output Makes NO Sense

Jun 10, 2009

here's my code (I'll explain in a second):

[Code]....

Code: - CA:true - TC:0 - CA:true - 1 - TC:1There's no logic in that! The output proves that both parts of the array are true. And yet, the "if" statement only activates once!

View 8 Replies

ActionScript 3.0 :: HTC Sense Homescreen Slider 'alike'

Oct 19, 2010

I'm looking for a way to make a simplified version of the HTC Sense Homescreen slider. I had something like this in mind: [code]I basically need to make 8 homescreens. Each homescreen is an interaktive movieclip. Nothing fancy is going to happen inside those movieclips.No navigation buttons, just a plain and simple drag and slide with movieclips.I have a bit knowledge using greensock tweens also - so if you got a solution with this please share your knowledge.

View 1 Replies

Flash :: 1046: Type Was Not Found Makes No Sense

Oct 21, 2010

I've got several custom classes. Let's call them "Character", which is supposed to import and use "Head". Then "Head" imports and uses "Hat". That works just fine...

[Code]....

This runs without a hitch. Simple as pie... But if I try to create a new instance of "Hat" or even define the Hat variable in "Character", it gives me the compile time error: 1046: Type was not found or was not a compile-time constant: Hat. If I try to define "Hat" class and create a new instance of "Hat" in my main script, or in "Hat" it works like a charm... If I try to do it in my "Character" it gives me this godforsaken error. I've checked my imports, they're all the same!! Why in the world is it doing this?!

View 3 Replies

ActionScript 2.0 :: Movie Clip Not Being Removed, Makes No Sense?

May 8, 2007

Code:
function showBigScreen()
{

[code].....

View 6 Replies

Document/Stage Size ::- Sizing To Contents Not Making Sense?

May 31, 2009

I have a Flash CS4 document and I am attempting to resize the stage to accomodate its current contents.When I do so, the stage becomes *much larger* than the apparent contents, and I am trying to figure out why. I have literally examined every frame of the animation, and selected every individual object to see if the selection bounds indicate a rogue "large object"...but none indicate this...what sort of things about the contents might cause this that I am missing?

View 7 Replies

ActionScript 2.0 :: Class Names And There Is Virtually No Sense To Change The Strings?

Dec 7, 2009

MIX-ActionScript is my FLASH scripting language developed to confuse a small tool that can be function names, object names, variable names, class names and there is virtually no sense to change the strings, and at the same time very similar to the same time, this confusion is irreversible .Confusion after the code will bring some resistance to anti-compiled for your application security to provide protection.MIX-AS functional and ActionScript Obfuscator similar, unfortunately, this tool has not been updated.[URL]..

View 5 Replies

ActionScript 3.0 :: No Object Events In API?

May 29, 2008

how to make the custom class to pass the information.

My question is this: Why did Adobe not create such an event in the default API? What downside is there to using this method as the main way to pass information between MVC style components? Since they made special events for everything else, and its such a common practice, surely there must be some reason why it wasn't done.

View 2 Replies







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