AS 3.0 reference problem

Posted by vasion on Stack Overflow See other posts from Stack Overflow or by vasion
Published on 2010-04-10T11:22:27Z Indexed on 2010/04/10 11:23 UTC
Read the original article Hit count: 322

Filed under:
|
|

I am finding it hard to fugure out the reference system in AS 3.0.

this is the code i have (i have trimmed it down in order to find the problem but to no avail)

package rpflash.ui {

import flash.display.Sprite; import flash.display.MovieClip; import flash.display.Stage; import nowplaying; import flash.text.TextField;

public class RPUserInterface extends Sprite{

var np:nowplaying;

public function RPUserInterface(){ }

public function init(){ var np:nowplaying = new nowplaying(); this.addChild(np) } public function updateplayer(xml:XML){ var artist: String = xml.nowplaying.artist.toString(); var title: String = xml.nowplaying.title.toString(); trace("UI:update"); trace(this.np);// this gives me a null reference } } }

and still i cannot access np!!! trace this.np gives me a null reference. i am not even trying to access it from a subling class. (btw i def want to know how to do that as well.)

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about reference