Hi Amir,
I believe you have a scope problem here. The compiler doesn't know wich
object is dispatching the event.
You should use your dispatcher object or instance to call that method.
Also you now need to initialize your dispatcher object to the
EventDispatcher class
for exemple :
import mx.events.EventDispatcher;
function dispatchEvent() {};
function addEventListener() {};
function removeEventListener() {};
var myDispatcher:Object = new Object();
mx.events.EventDispatcher.initialize(myDispatcher);
var myListener:Object = new Object();
myListener.onEvent = function() {
trace("onEvent triggered");
};
myDispatcher.addEventListener("onEvent", myListener);
then later in your code you can trigger the event on a button click like
this :
myBtn.onRelease = function() {
sendEvent();
};
function sendEvent():Void {
var eventObject:Object = {target:myDispatcher, type:'onEvent'};
myDispatcher.dispatchEvent(eventObject);
}
This is how you should use events in Flash 8, read the docs, look for
tutorials and you'll see similar examples or better
Hope this helps
Alain
Amir Cicak wrote:
Hello, after upgrading to flash 8 following line does not dispatch event
anymore:
dispatchEvent({type:"klik", target:this, link:Tekst});
It works ok in flash 7. Anyone knows what could be the problem? I made
component and this code is in components class. Are there some new things I
need to watch out for in flash 8 related to event dipatching, initialising
dispatcher, class, component, linkage, etc.? Thank in advance...
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders