Note that there are some explanatory texts on larger screens.

plurals
  1. POAS3 Pass Custom Event Data Question
    text
    copied!<p>I am trying to pass custom event data from 1 class to another class...here is my codes..</p> <p>a.as</p> <pre><code>private function onClick(event:MouseEvent):void{ dispatchEvent(new YouTubeSearchEvent(YouTubeSearchEvent.CHANGE_VIDEO_READY, videoId)); } </code></pre> <p>b.as</p> <pre><code>private var newVideoID:String; public function get selectedVideoID():String{ return newVideoID; } private function buildSingleCont(videoResult:Array):void{ tn=new a(); addChild(tn); tn.addEventListener(YouTubeSearchEvent.CHANGE_VIDEO_READY, getNewVideoID); } private function getNewVideoID(event:YouTubeSearchEvent):void{ newVideoID=event.videoResult; } </code></pre> <p>c.as </p> <pre><code> // this is the main class..... private var newvideoida:String; public function c(){ createSearchContainer() //this method is called before b.as and c.as are called... } private function createSearchContainer():void{ searchContainer=new b(); newvideoida=searchContainer.selectedVideoID; //I want to get b.as newVideoID variable trace(newvideoida); //display nothing..... addChild(searchContainer); } </code></pre> <p>package com.search.events { import flash.events.Event;</p> <pre><code>public class YouTubeSearchEvent extends Event { public static const FEED_VIDEO_READY:String="feed_video_ready"; public static const CHANGE_VIDEO_READY:String="change_video_ready"; public var videoResult:*; public function YouTubeSearchEvent(type:String, videoResult:*) { super(type); this.videoResult=videoResult; } public override function clone():Event { return new YouTubeSearchEvent(this.type, this.videoResult); } } </code></pre> <p>}</p> <p>I appreciate any help..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload