What is the deal with application.parameters?

I send a userId to my application to display a linechart with the application.parameter object. I get the userId parameter inside my application and can trace or alert it and I see the userId on my screen. Ok everything is working fine for now. Then I want to use the userId to call php function. And there is where it breaks. Somehow the userId parameter is empty.


                       private var userId:int = 1234;

			private function init():void{
				this.userId = Application.application.parameters.userId;

for this example I set a default value of 1234 and on creationComplete the userId is set with the real userId value, lets say that the userId in parameters is 1. If I trace the userId inside the application after the init() it returns 1. That is normal. But if I now call the remoteObject:


With this call the php function receives a userId with 1234. Very strange because we already set that with an other number.

solution for me
I tried a lot of different ways to fix this problem and now I finally found a solution. I set the value of the userId parameter inside a invisible label. And use that label to send the userId back to php.

this.userIdLabel.text =(this.userId).toString();

and in the remoteObject:



8 responses to “What is the deal with application.parameters?”

  1. Tom Chiverton Avatar

    What happens if you make the private variable a string, not an int ?

  2. Arno Manders Avatar

    I keep the same problem. Inside the application everything is going well but when I send it to php he sends nothing.

  3. Pete Avatar

    I’m not familiar with amfphp, but as you’re setting userId from parameters try casting it as an int there and then, as all flashvars are stored in the parameters obejct as String.

  4. mloncaric Avatar

    Did you declare userId variable as Bindable?

    1. Arno Manders Avatar
      Arno Manders

      @mloncaric: wow amazing that this is really working. I have to admit that I thought your solution was ridiculous. But then I realized it could work but that also means that the userId argument is set on application start and is not a reference to the variable.

      what is very strange because in the same method I have the selectedItem of a comboBox as argument and that is working correct. Why is that working correct?

  5. Arno Manders Avatar

    @Pete: well in my example i’m not doing that because it doesn’t care but in my code I’m doing it: this.userId = int(Application.application.parameters.userId);.

  6. Zjéraar Avatar

    Sheesh, Arno, didn’t you know that? It’s, like, beginners stuff. 😉

  7. mloncaric Avatar

    ComboBox#selectedItem is also Bindable so thats why 🙂
    Sorry for being so late..

Leave a Reply

Your email address will not be published. Required fields are marked *