Expand my Community achievements bar.

SOLVED

dynamical usernames via flashvars

Avatar

Former Community Member

Hey guys,

i'm trying to generate the username dynamically by a given var.

I send the var to the .swf:

<object width="500" height="300"
    data="test.swf?userNAME=<?= $username ?>"
    type="application/x-shockwave-flash">
  <param name="WEBCAM" value="test.swf?userNAME=<?= $username ?>">
</object>


In the .mxml file i collect it with this code:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:rtc="AfcsNameSpace" creationComplete="initVars()">
  <mx:Script><![CDATA[
     // Declare bindable properties in Application scope.
     [Bindable]
     public var userNAME:String;
    
     // Assign values to new properties.
     private function initVars():void {
        userNAME = Application.application.parameters.userNAME;
     }
  ]]></mx:Script>

When i display the var userNAME with that piece of code everything is fine:

<mx:Label text="{userNAME}" fontWeight="bold"/>

But when i try to set the username with:

<rtc:AdobeHSAuthenticator userName="{userNAME}"/>

it doesn't work. (it's just "null")

I read something that the vars are only ready after the .swf is completely loaded.

Can you give me a hint how to solve that problem?

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Employee

It's part of the SDK, in sampleApps/ExternalAuthentication/flex

View solution in original post

4 Replies

Avatar

Employee

I have similar code in the ExternalAuthentication example and it works:

private function init():void {

roomURL = Application.application.parameters["roomURL"];

authToken = Application.application.parameters["authToken"];

cSession.login();

}

Try to change this:

userNAME = Application.application.parameters.userNAME;

To this:

userNAME = Application.application.parameters["userNAME"];

Avatar

Former Community Member

Thanks for your fast answer, but it gives the username "null" yet.

Can i see the source of the .swf file of the ExternalAuthentication somewhere?

Thanks so far!

Avatar

Correct answer by
Employee

It's part of the SDK, in sampleApps/ExternalAuthentication/flex

Avatar

Former Community Member

Oh jesus. I just always looked in the ExternalAuthentication/php.

Thanks!