Custom event bubbling, 2 levels up from ObjectContainer3D to Sprite

Software: Away3D 3.x

maidbarion, Newbie
Posted: 13 October 2011 03:06 PM   Total Posts: 1

Hi Guys,

I’m using Away3D 3.6 (last one before 4) and I’m having some issues with firing off custom events. Ok so here’s how my project is structured…

Class level 1 extends Sprite

Class level 2 extends Sprite and contains the view and scene

Class level 3 extends ObjectContainer3D and contains a few more ObjectContainer3D

Class level 4 extends ObjectContainer3D (These are buttons that dispatch the events).

I want class level 2 to hear the event that’s being dispatched by 4 but no matter what I do it can only be heard if it’s 1 level above or below. Here’s the custom Event I’m using…


package project.event {

import flash.events.Event;

public class ModelEvent extends Event {
 
  public static const ON_MODEL_CREATE:String = “onModelCreate”;
 
  public var _data:*;
 
  public function ModelEvent(type:String, data:*, bubbles:Boolean=false, cancelable:Boolean=false) {
 
  _data = data;
 
  super(type, bubbles, cancelable);
 
  }
}
}


Then we’re firing it using…

dispatchEvent(new ModelEvent(ModelEvent.ON_MODEL_CREATE, anyData, true));

Then we’re listening to it like this (menuHolder is and instance of class 3) ...

menuHolder.addEventListener(ModelEvent.ON_MODEL_CREATE, onMouseSend);

protected function onMouseSend(evt:ModelEvent):void {
 
  trace(evt._data);
 
}

Any ideas??? I was thinking there was some conflict where a standard sprite was having a hard time communicating through ObjectContainer3D. Your help would most awesome!!

Cheers,

A.

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X