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

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

using skin object for transfering DisplayObject to Avatar i

Postby kuzniz » 30 Mar 2012, 16:19

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: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: using skin object for transfering DisplayObject to Avata

Postby Bax » 02 Apr 2012, 12:43

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

Postby kuzniz » 13 Apr 2012, 16:51

hi,

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

10x

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 35 guests