go back to the articles list

Is there any static variable type available in server side?

Question:
Is there any static variable type available in server side ? so that I can change that variable globally.

Answer:
Yes. With FMS2 you can actually set variables in the application.xml file. Now if you set these variables in this file and put the application.xml file in the application directory, the variables you set will be available to instances of that application only. Not any others.

If you don't put an application.xml file in the application directory of the application that you are running, then FMS will default to the level higher which would be the conf directory for the virtualhost you are running and look in there. That's where we are going to set our variable.

So, open up the application.xml file in some text editor and jump down to the tag
<code><JSEngine></code>

In there we are going to add a couple of new tags:
<code><ApplicationObject></code>

Inside there:
<code><config></code>

And in there we are going to add a super user tag and put my name in it:
<b>superUser</b>

<i>Graeme Bull</i>

So it looks like this:
<code>
<JSEngine>

     <ApplicationObject>

          <config>

               <superUser>Graeme Bull</superUser>

          </config>

     </ApplicationObject>

</JSEngine>
</code>

Now, save the file, restart the server and make a main.asc file because we are now going to trace this value out:

application.onAppStart = function(){
     trace("The Super User is: " + application.config.superUser);
}

Now when you start up the application you should see the following trace:

<b>The Super User is: Graeme Bull</b>

That's it :)

Posted by: Graeme Bull on Feb 04, 2006

Share This Article

STi Video Recorder for Wowza Media Server HD Edition v3

STi Video Recorder for Wowza Media Server HD Edition v3

This is our latest version of our Video/Audio recording application that runs right in the browser through the Flash Player. You have the option to choose to record between three different sizes, review your recording and even save it if you want in a list to view later. It's like a mini video content management system of all your recorded videos. Once recorded the application provides a simple way to link to the page where the bonus video player (included in the package if you want to use it) where the video can be played back. There is also an option to embed the player in a web page or blog.

$89 Buy Now