Page 1 of 1

using skin object for transfering DisplayObject to Avatar i

Posted: 30 Mar 2012, 16:19
by kuzniz
Hello,

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

Re: using skin object for transfering DisplayObject to Avata

Posted: 02 Apr 2012, 12:43
by Bax
I don't think you can do this. You will need a more complex swf containing the avatar assets, capable of loading external entities.

Re: using skin object for transfering DisplayObject to Avata

Posted: 13 Apr 2012, 16:51
by kuzniz
hi,

I have solved it by putting the imagein url sending the url test and then attaching the images

10x