I would like to add my dynamic image to the avatar, for that I want to pass a DisplayObject to the skin:object before calling openSpace.createMyAvatar
like this ....
Code: Select all
private function generateSkin():Object
{
var isMale:Boolean = main.rb_male.selected
var skin:Object = {}
skin.sex = isMale ? "m" : "f"
skin.race = "european"
//skin.hair = main.cb_hair.selected ? (isMale ? "hair1" : "hair2") : ""
//skin.bust = main.cb_bust.selected ? (isMale ? "shirt1" : "shirt2") : ""
//skin.legs = main.cb_legs.selected ? (isMale ? "jeans1" : "jeans2") : ""
skin.hair = (isMale ? "hair1" : "hair2")
skin.bust = (isMale ? "shirt1" : "shirt2")
skin.legs = (isMale ? "jeans1" : "jeans2")
skin.title = main.gTitle
skin.clogo = main.gLogo
and in the ExampleGhost.as do this
public class ExampleGhost extends Avatar
....
override public function init():void
{
.....
tf_title.text = this.skin.title
var logo:MovieClip =getChildByName("Logo") as MovieClip
var logo2add:DisplayObject = this.skin.clogo
if ( logo2add != null) logo.addChild(logo2add)
....
somehow the string is passing ok but the displayobject is not ( i am geeting a null object in the ExampleGhost script)
what do i do worng?
is there another way to pass dynamiclly image to ExampleGhost.as script ( i can put the image on a web site and retrive it from there but it look massy..)
thanks
Shachar