using skin object for transfering DisplayObject to Avatar i

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

Post Reply
kuzniz
Posts: 19
Joined: 05 Jan 2012, 07:21

using skin object for transfering DisplayObject to Avatar i

Post 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
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: using skin object for transfering DisplayObject to Avata

Post 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.
Paolo Bax
The SmartFoxServer Team
kuzniz
Posts: 19
Joined: 05 Jan 2012, 07:21

Re: using skin object for transfering DisplayObject to Avata

Post by kuzniz »

hi,

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

10x
Post Reply