INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Metamorphis.SetStateValue Question  (Read 2043 times)

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5906
  • Farm Animal Stupid
Metamorphis.SetStateValue Question
« on: December 11, 2002, 06:12:04 pm »

I'm working on a skin and I'm trying to use the SetStateValue function. For some reason, this isn't working and I'm getting a message that says : Wrong number of arguments or invalid property assignment.

I can't figure out where the problem is. I've narrowed it down to my use of SetStateValue. Anybody have any ideas what the problem is?


function TogglePlaylist()
{
 if (SongInfo.ShowWindow)
 {
   if (Pos.ShowWindow)
   {
     Metamorphis.SetStateValue("PosVol","Pos");
     HidePos();
   }
   else
   {
     Metamorphis.SetStateValue("PosVol","Vol");
     HideVol();
   }
   HideInfo();
   ShowPlaylist();
 }
 else
 {
   var qwerty = Metamorphis.GetStateValue("PosVol");

   if( qwerty == null)
   {
     qwerty = "Pos";
   }
   HidePlaylist();
   if (qwerty == "Pos")
   {
     ShowPos();
   }
   else
   {
     ShowVol();
   }
   ShowInfo();
 }
}
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41956
  • Shoes gone again!
Re: Metamorphis.SetStateValue Question
« Reply #1 on: December 12, 2002, 01:41:09 pm »

I'm not sure, but Nikolay is back Monday and he'll know for sure.
Logged
Matt Ashland, JRiver Media Center

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5906
  • Farm Animal Stupid
Re: Metamorphis.SetStateValue Question
« Reply #2 on: December 15, 2002, 11:45:57 am »

Nevermind, I figured it out. I was incorrectly using the ShowWindow function, thinking it would return a boolean variable stating whether or not the window was visible, when I should have been using IsWindowVisible for that purpose.

My problem wasn't with SetStateValue at all. :P

So it all works just fine now. :)
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5906
  • Farm Animal Stupid
Re: Metamorphis.SetStateValue Question
« Reply #3 on: December 16, 2002, 09:41:56 am »

Well, while I did figure out THAT problem, I'm now having another one that does seem to be related to SetStateValue.

Basically what's going on is this. I have 4 windows on this particular skin: SongInfo, Vol, Pos, and Playlist.

Now.... Playlist and SongInfo cannot be shown together. Pos & Vol both should ONLY show up along with SongInfo, and neither Pos & Vol can be shown at the same time.

So let's say I have SongInfo and Pos shown. I then switch to Playlist. So I hide SongInfo and Pos, and show Playlist. Now when I come back from Playlist, I know I'm coming back to SongInfo, but I need some way of determining if I need to also show Pos or Vol. The way I've been trying to keep track of which one of those two is "on" was at first by using SetStateValue, but since I was getting mixed results using that, I switched to just a global variable that would store that info while the skin was active. Then I would just use SetStateValue to store the value of that variable when the skin exited, so that I could read it back when the skin starts so I can set everything back to the way it was when you left.

The problem is, I noticed that sometimes SetStateValue is recording a value of "Global" instead of "Pos" or "Vol".  What I can't understand is where it's getting the value of "Global" from. I have to functions, ShowPos and ShowVol that do just what they say, and when they do it, they set the value for that global variable. So when ShowPos fires it also sets the value of PosVol (the global variable) to "Pos" and when ShowVol fires it sets PosVol to "Vol".  So right there, as long as one of these two functions has fired during the running of this skin, PosVol should be either "Pos" or "Vol".

Now, in my OnInitialize function, I have assign PosVol the value that GetStateValue retrieves from state.xml. So there should never be a time when this variable has an undefined value. And yet it still winds up with this "Global" value from time to time.

Any ideas just from listening to me? Probably not, I'm sure, so if you need me to, I'll post a link to my main.js for you to look over... actually, I'll do that anyway.
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5906
  • Farm Animal Stupid
Re: Metamorphis.SetStateValue Question
« Reply #4 on: December 17, 2002, 05:25:07 am »

Ok, as promised, here's the link...

http://doof.webryders.com/MJ/Downloads/Misc/main.txt


Is anybody even reading this?
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5906
  • Farm Animal Stupid
Re: Metamorphis.SetStateValue Question
« Reply #5 on: December 23, 2002, 11:18:20 am »

Just out of curiosity...

When Matt said that Nikolay would be back Monday, which Monday did he mean?
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 71439
  • Where did I put my teeth?
Re: Metamorphis.SetStateValue Question
« Reply #6 on: December 23, 2002, 11:31:49 am »

Sorry, doof.  He's back now.  He came back broke from Disneyworld last Monday.

I sent him a reminder about this, but we're taking a lot of time off this week and next.
Logged

KingSparta

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 20048
Re: Metamorphis.SetStateValue Question
« Reply #7 on: December 23, 2002, 02:41:56 pm »

Quote
which Monday did he mean?


June, 2nd week
Logged
Retired Military, Airborne, Air Assault, And Flight Wings.
Model Trains, Internet, Ham Radio
https://MyAAGrapevines.com
Fayetteville, NC, USA

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5906
  • Farm Animal Stupid
Re: Metamorphis.SetStateValue Question
« Reply #8 on: December 24, 2002, 04:53:49 am »

Time off? What do you guys think this is? Some sort of holiday or something?!? ;)

Hey, take your time. You guys deserve a break. I was just poking a little fun. :)
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5906
  • Farm Animal Stupid
Re: Metamorphis.SetStateValue Question
« Reply #9 on: January 07, 2003, 11:37:22 am »

Ok, we're going on a month now...  ;)
Logged

Nikolay

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 1681
  • Former CTO, JRiver, Inc.
Re: Metamorphis.SetStateValue Question
« Reply #10 on: January 09, 2003, 09:21:49 am »

Doof,

I'm back!

Well..., I could not find any problems in your code or in our code. The only explanation I can find is that PosVol variable has to be initialized. Try replacing code:

var PosVol;

with:

var PosVol = "Pos"

Let us know if that helps.

Regards,
Nikolay
Logged
Pages: [1]   Go Up