Jump to content


number and xml ? possible?


  • You cannot reply to this topic
9 replies to this topic

#1 ribo6

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 28 January 2006 - 03:25 PM

I am trying to load into flash file a variable from xml file. I can even trace it.
But when I am trying to get it to work in a color transformation, it isn't working.
Code:
var my:Number = this.firstChild.childNodes[0].childNodes[3].firstChild; //getting a "number" (e.g. 99) from an xml file, I skipped the xml file loading process 
var trans:Transform = new Transform (_root.bookmarks_btn.bookmarks_btn_bkg); 
var bookmarks_btn_bkg:ColorTransform = new ColorTransform (my, my, my, 100, 0, 0, 0, 0); 
trans.colorTransform = bookmarks_btn_bkg; 
trace (bookmarks_btn_bkg); //(redMultiplier=NaN, greenMultiplier=NaN, blueMultiplier=NaN, alphaMultiplier=100, redOffset=0, greenOffset=0, blueOffset=0, alphaOffset=0)


redMultiplier=NaN, greenMultiplier=NaN, blueMultiplier=NaN
Where could be the problem?

Edited by ribo6, 28 January 2006 - 03:26 PM.


#2 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 28 January 2006 - 03:51 PM

Can I see your XML?

#3 ribo6

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 28 January 2006 - 04:30 PM

<?xml version="1.0"?>
<variables>
<colors>
<a></a>
<b></b>
<c></c>
<d>29</d> ////EDIT: I'm accessing this variable
<f>
<r>29</r>
<g>15</g>
<b>12</b>
</f>
</colors>
</variables>

Edited by ribo6, 28 January 2006 - 04:37 PM.


#4 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 28 January 2006 - 06:47 PM

I'm not very sure if you can handle the colortransform class like that!
Maybe you should have a closer look at the AS manual..

#5 ribo6

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 28 January 2006 - 06:57 PM

What I actually want must be simple. But something I don't understand.
I want just to get a variable from xml file, in this case just a number and use it in this transformation.

#6 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 28 January 2006 - 07:24 PM

Since I didn't used the transformclass so often, I can't really say what's the problem.
First thing that came in mind as I was the NaN was that you are sending a string and not a number as required.

actually it would be cool if you could post your fla somewhere so I can have a look at it later on. (it's 2am here)

#7 ribo6

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 29 January 2006 - 05:34 AM

http://www.mytempdir.com/416387
The same problem appear when I use setRGB as well, so it is not only ColorTransform issue.

Edited by ribo6, 29 January 2006 - 05:37 AM.


#8 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 29 January 2006 - 05:42 AM

I still didn't checked the file, but if you say that it doesn't work also with the setRGB, then it's because your variable is not a number (NaN)
I will have a look at it as soon as I'm at home

#9 ribo6

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 29 January 2006 - 11:33 AM

Problem is solved.
var my:Number = new Number(this.firstChild.childNodes[0].childNodes[3].firstChild.nodeValue);
var bookmarks_btn_bkg:ColorTransform = new ColorTransform (my.valueOf(), my.valueOf(), my.valueOf(), 100, 0, 0, 0, 0);
Now 'my' is not a string any more. But thank you anyway, funkysoul.

#10 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 29 January 2006 - 11:52 AM

lol, funny.. I came to that solution right now also ;)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users