Global Username Variable

Coming from a CF background, I have always been able to set
my user's login username in a variable scope that the entire
application could reference (session). I know that in Flex/Flash
there is no sessions since Flex is a persistent application.
How do you set a global variable that can be used by the main
application, component, and modules to help thin out data?

"projectproofing" <[email protected]> wrote
in message
news:g96a2b$pv3$[email protected]..
> Coming from a CF background, I have always been able to
set my user's
> login
> username in a variable scope that the entire application
could reference
> (session). I know that in Flex/Flash there is no
sessions since Flex is a
> persistent application.
>
> How do you set a global variable that can be used by the
main application,
> component, and modules to help thin out data?
Google the Singleton pattern in Flex.
HTH;
Amy

Similar Messages

  • Global flash variables

    Hi example #1 pulls data from a php script into
    flash.........my problem is i can't access that data from anywhere
    else in the script...........I'd like to somehow make.....username
    = myLoadVars.valid; ....variable global.....or make the php data
    global so i can access the data from anywhere within the flash
    script.
    I've tried alot of ways to accomplish
    this...._global.....var.....trace from outside the onload
    function......every which way you can think of but I always get a
    trace output of undefined.......or the data isn't
    accessible....Please help...i've given it my best effort.
    example#1
    var myLoadVars:LoadVars = new LoadVars();
    myLoadVars.onLoad = function( success ){
    if(success){
    username = myLoadVars.valid;
    trace(username);
    myLoadVars.load('test4.php');

    the script i have works for me but say i want to trace the
    username variable from
    the end of the current script......the below example
    demonstrates what i mean and the trace output says undefined.....my
    problem is I cannot access the username variable from anywhere
    except inside the myLoadVars.onLoad function.
    var myLoadVars:LoadVars = new LoadVars();
    myLoadVars.onLoad = function( success ){
    if(success){
    username = myLoadVars.valid;
    trace(username);
    myLoadVars.load('test4.php');
    trace(username);

  • Dealing with a turn based application with using a global static variable

    Hi there. I read some articles about JavaFX concurrency,so as a newbie i have to practice on it. Now i'm trying to implement a turn based application that can be played among 3-6 players. Moreover, i use a scene imported from a .fxml file and i have to update it correctly depends on some calculations of each thread (in other word players ). My main issue is, i don't wanna use a while loop which checks the state of game like;
    while( GameState != State.GAME_OVER ){
         currentPlayer = GameBoard.getNextPlayer();
         // do some actions,calculations etc.
    So, i want to use worker threads instead of this while loop. I guess using Service class for iterating and assigning the next player will be suitable instead of using the while loop and Tasks for doing each player's calculation,or waiting for some responses from Human players on UI based,however, i'm struggling with two problems.
    There should a global static variable ( like GameState which is an Enumarator ) determines the state of the game,so it should be updated and should be checked by each turn. Is there any way to do this ?
    How can i get rid off this while loop ?
    I will appreciate for every answer. Thanks anyway.

    It shouldn't make too much difference. The basic idea is that you have a model class representing your game state (the Game class in jsmith's example). When a player makes a move, you update the state of the game. Since this will result in changes to the UI, this update should be performed on the FX Application Thread.
    If the player making the move is a human player, the move will likely be made by a user action (button press or mouse click, etc); this will be handled on the FX Application thread anyway.
    When the state of the game changes so it is the turn of an "artificial" player to make a move, have the object representing the artificial player calculate its next move, and then update the game state. Since this is a response to the game state changing (it's now the turn of the artificial player), this will also be on the FX Application Thread.
    The only (slight) complexity comes if the calculation of the move for the artificial player takes a long time. You don't want to perform this long running calculation on the FX Application Thread. The cleanest way to manage this is to launch a Task which calculates the desired move, and then updates the game state when the move is ready. So, something like this:
    GameState game = ... ;
    // UI is bound to the game state.
    ExecutorService executorService = ... ;
    final Player currentPlayer = game.getCurrentPlayer() ;
    final Task<Move> calculateMoveTask = new Task<Move>() {
         @Override
         public Move call() {
              Move move = // compute next move...
              return move ;
    calculateMoveTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
         @Override
         public void handle(WorkerStateEvent event) {
              gameState.makeMove(currentPlayer, calculateMoveTask.getValue());
    executorService.submit(calculateMoveTask);
    If you're doing more threading than that, you're probably doing it wrong... . There should also be no need for anything to be held as a "global" static variable (the idea above is the only structural modification you need to the example posted by jsmith).

  • Global Container Variable

    Hi
    Give me idea on Global Container variable in Graphical mapping.
    Thanx in Advance

    Hi
    Ref this
    /people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
    http://help.sap.com/saphelp_nw04/helpdata/en/95/bb623c6369f454e10000000a114084/content.htm
    Design and Configuration [original link is broken]
    Thanks
    Sridhar

  • Global Constants / Variable in OSB

    I want to define global Constants / Variable in OSB and I want to access them in XSLT when I am tranforming the requests...
    Any idea how can I do that?
    I want to use these variables and constants for server name and ports (in different environment) and some other stuff.

    We have done a similar implementation for the same scenario. We have created a Xquery where we put in the configuration information as an XML and then in the pipeline stages we use the Assign the Xquery to a a temporary variable and then use the values of the xml using relative xpath expressions.
    This way any time we need to make any changes to the confguration we know once place we can change and it gets reflected in the complete code base.
    Below is how we have done it:
    - create a Xquery with xml configurations (say commonconfig.xq)
    - then using the Assign action get the output of this xquery into a temp var (say commonConfig)
    - then use the configurable values using the relative xpath in the Assign action (say Assign $commonConfig/param1/text() to param1Value
    Let me know if you need further information.
    Thanks,
    Patrick

  • Global Counter Variable - Graphical Mapping

    Hi there.
    Can anybody help with implementing a global counter variable in the graphical mapping please.
    I am trying to populate the "SEGMENT" field of an IDoc with the correct sequence, i.e. add 1 for each new segment. The IDoc has several segments, most of which are embedded. I have tried using the "<b>counter</b>" function but this seems to reset back to one for each instance of it being called.
    I would appreciate any pointers.
    Thank you.
    Mick.

    Hi see this for implementation
    <b>defining Global Variables</b>
    ArrayList arrVI;
    int counter =0;
    <b>Initialization Section</b>
    arrVI= new  ArrayList();
    <b>assignment</b>
    arrVI.add(sVI[iLoopCounter]);
    counter++;
    <b>
    fetch Values</b>
    for (int i =0;i<counter;i++)
    result.addValue(arrVI.get(i)+"");
    Mudit

  • Comma problem with global string variable

    Hi,
    I'm fiighting with comma problem for global string variable. I've on page string for example "7nndqrr52vzyb,0" and by dynamic column link I'm assigning this string to global variable. Then I'm trying to display value of that global variable on another page but I see only string till comma, nothings more. I'm not sure what I'm doing wrong because when I'm trying to assign that value normally by computation process as a constant value is fine and see on another page correct string. I'll be really glad for help.
    Thanks
    Cheers,
    Mariusz

    When it tries to display the string, it sees the comma and wants to believe the string is terminated. You could escape the , in the string or replace it with a different character..
    See this link: http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/concept.htm#BEIGDEHF
    Thank you,
    Tony Miller
    Webster, TX
    If vegetable oil is made of vegetables, what is baby oil made of?
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Global Application variable

    How do I set a global application variable in a Swing application?
    Namely
    MDI display opens a new window
    new window sets a variable
    close the new window and return to the MDI window
    MDI window needs to use the variable.
    Note: the new window is is its own class object.

    What are you talking about?
    Static variables are "global".
    In some class (it does not really matter which) define
    a static variable. O.K. now you have a "global"
    variable.
    Some people may say that this is "bad" programming
    practice, but it is what you asked for.public static variables of public classes are 'global' in the sense you can refer to them if anywhere in an application. Public classes are also 'global' in this sense.
    However, we don't call them global variables, they are class variables. A global variable is generally defined to be one that is associated with the running application. It has no context other than that. It can be used anywhere at any time without any qualifications. In other words, the are terrible.
    I had to maintain an application that had 50 or so global variables. Some of these variables represented the exact same piece of information so it was cruicial during modifications to make sure that they were kept in sync. Don't use this type of design.

  • Corrupt Global User Variable?

    We're running ICM 7.5 and over the weekend, calls stopped routing to one skill.  AT&T, our first line, worked with Cisco and after research/testing, came back with an answer that the global user variable was corrupt.  Has anyone experienced this?  It seems odd that out of the blue this becomes corrupt, especially over a weekend when call volume is low.
    My team, along with Network and AT&T did a process of elimination, removing translation route & global user to validate call routing and adding each piece back.  When the variable was added, call routing failed to backup routing.
    Thanks,
    Jill M Gorrie

    Hi,
    User variables are meant to be used in web forms and web forms only. You can certainly pass their values to business rules when you used them in POV or page section of the form during save. All you need to do is to create another business rule (local or global) variable in business rule on the corresponding dimension and use it in your business rule. If you enable running the business rule on save and using the form values for variables options in form properties, business rules would replace the values of business rule variables with the values that are set in user variables.
    Cheers,
    Alp

  • Username variable character length - Captivate 7

    Hello,
    I have a "username" variable in place before my quiz slides on a project.  Once the user has viewed the module they are prompted to put in their name before the quiz.  After they complete the quiz, a completion certificate is generated with their name listed.  Problem is, I am only getting 15 characters to show.  I have my length set to 100 in the properties, but it only shows 15 characters.  Any way to fix this?  Any help would be very appreciated. 
    Thanks,
    Jen

    One more tip: NEVER type a variable, insert it always with the X button in the Format accordion of the Text container. Variables are case sensitive, this will spare you eventual mistakes.
    Is your question answered?

  • How to assign itemrender variables in global public variable of my applicaton.

    Hi Friends,
    How to assign internal item render values in global public variable. can u see below example.
    List have one itemrender,within the itemrender i am using data grid .The  dataGrid have itemrender.now i tried the data grid itemrender assign values to public variable of my application,but the Error came... How can u slove this Problem Any One can Help to me.
    Example:
    public var myData:arrayCollection;
    <mx:List variableRowHeight="true" dataChange="validateNow()"  width="900" id="Lst_userlist" verticalScrollPolicy="off"  horizontalScrollPolicy="off" 
         buttonMode="true">
    <mx:itemRenderer>
      <fx:Component>       
       <mx:VBox paddingTop="-5"  horizontalScrollPolicy="off" verticalScrollPolicy="off" >        
             <fx:Script>
              <![CDATA[        
               override public function set data(value:Object):void
              ]]>
             </fx:Script>
             <mx:VBox id="vbox_grid" horizontalScrollPolicy="off" verticalScrollPolicy="off" width="890"  paddingLeft="10" paddingTop="5"
                     backgroundColor="#317152" color="#FFFFFF">        
              <mx:DataGrid visible="false" includeInLayout="false" height="100%" id="membershipGrid" alternatingItemColors="[#DCDCDC,#F8F8FF]"
                  paddingLeft="5"  horizontalScrollPolicy="off" color="black"
                  horizontalGridLines="false" verticalScrollPolicy="auto"  verticalGridLines="false"   rowHeight="25"
                  borderSkin="{null}" showHeaders="true" borderVisible="false" dataProvider="{data.dataCollection}" width="900" >
               <mx:columns>
                <mx:DataGridColumn width="180" headerText="Name" minWidth="150" sortable="true"  wordWrap="true" >
                 <mx:itemRenderer>
                  <fx:Component>
                   <mx:HBox horizontalScrollPolicy="off"   >
                    <fx:Script>
                     <![CDATA[
                      override public function set data(value:Object):void
                      function Click_Name():void
                        outerDocument.myData=data;  //  Here Error  came                 
                     ]]>
                    </fx:Script>
                    <mx:Image id="fileimg"    buttonMode="true"  toolTip="This is the User's Home Organization"/>          
                    <s:Label  id="lbl_Gridcloumn_name"  width="200" buttonMode="true" textDecoration="underline"  click="Click_Name()"  />
                   </mx:HBox>
                  </fx:Component>
                 </mx:itemRenderer>
                </mx:DataGridColumn>
    </cloumn>
    </datagrid>
    Error:
            Access of possibly undefined property myData through a reference with static  type com.istmanagement.views:ProgramAcessRights_ComponentInnerClass3.
    Thanks,
    Magesh R.

    Hi Flex harUI ,
    Thanks man....because  of i was stugle in last one week.... once again Thanks.......

  • Accessing Tomcat Global Environment Variables

    Hello,
    I have tried to access Tomcat 5.0 (xx) Global Environment variables.
    I have the Integer simpleValue defined in the Tomcat Administrators panel under "Environment Entries"
    Here's my code:
    Context initContext = new InitialContext();
    Context envContext = (Context)initContext.lookup("java:comp/env");
    Integer i = (Integer)e.get("simpleValue");
    I have also tried and infiinite variation of this with no success (Accessing the Initialcontext directly)
    The Tomcat docs at: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html
    says:
    "<Environment> - Configure names and values for scalar environment entries that will be exposed to the web application through the JNDI InitialContext (equivalent to the inclusion of an <env-entry> element in the web application deployment "
    PLEASE HELP !!!
    Geir Ove

    This is a Tomcat bug. See http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14228.

  • Avoid Global Public variables...

    Hello Experts,
    I have declared few variables in package specification (l_test , l_test_2)and i'm using across the API procedures.
    But when i run the TOAD expert it says "Avoid defining global public variables in the package specification."
    So i thought of moving the code from package specification to package body...
    Is this a good approach and will my code work as it was working before if i declare in the body...
    Plz suggest ...
    Thanks...
    Earlier
    Package Specification Part
    CREATE OR REPLACE PACKAGE PKG_TEST
    AS
    l_test NUMBER(1);
    l_test_2 NUMBER(2);
    END;New
    CREATE OR REPLACE PACKAGE BODY PKG_TEST
    AS
      l_test NUMBER(1);
    l_test_2 NUMBER(2);
       PROCEDURE process
       IS
       END process ;
       PROCEDURE process_2
       IS
       END process_2 ;
    END PKG_TEST;

    Linus,
    Just so you are aware, the scope of those variables are different depending on if they are defined in the PACKAGE (SPEC) or PACKAGE BODY.
    Declared in the PACKAGE (Spec): Globally accessible to everything on the Schema.
    Declared in the PACKAGE (Body): Globally accessible to everything with that particular Package.
    So as you can see, this quite a big difference. TOAD is warning you because putting globals in the PACKAGE is a pretty sloppy coding practice that can easily lead to difficult to maintain code. While you can ignore it, I'd suggest not doing that. ;)
    In fact, I'd suggest avoiding globals altogether when possible. Passing parameters may be more time consuming, but it makes it very clear what each procedure/function should be doing, and future programmers will thank you. Time you'll save on initial programming will be made up when doing maintenance. But admittedly globals are useful, just be careful when using them. Getting your code to work isn't enough; you should aim to make it clear and understandable too.

  • Global PATH variables?[solved]

    How do i set global path variables in archlinux??
    I need to do this because ie, I am using gmrun, and I just installed xarchiver. But gmrun cant find xarchiver since it is located in /opt/xfce4/bin/.. I can append this to my PATH in .zshrc/ .bashrc file, but this only helps when i run it through the terminal.
    I want to also be able to have a global alias file, to run the alias xterm = 'xterm -bg black -fg white' through gmrun.
    Couldnt find any documents on how this works in archlinux.
    Last edited by jinn (2007-02-04 10:56:40)

    For the path, run 'bash /etc/profile' to update the path for the current terminal. You can also logout then relogin to set them for the whole session. No files needs changing.
    For the alias, create a 'etc/profile.d/alias.sh' file. add the alias in it and give it executable permission. For the change to take effect, you'll need to run  'bash /etc/profile' or logout/relogin.

  • Trace not showing Global container variable at mapping test time.

    Hi Folks ,
    I have a scenario file to Proxy scenario. At mapping time I am doing a lookup inside a UDF using JCO connections.
    Lookup is taking 2 fields(ex X an dY) as input and coming up with couple of fields in output.
    Output fileds I am storing in global container and want to access in further mapping .
    I am using trace to see variable values at mapping tijme
    Surprisingly :
    1. For a particular "X" field in Input, No output fields are coming at trace . On testing it end to end I can see fields getting populated at run time at lookup table . but not getting reflected at mapping trace . what could be the possible cause ?
    2.  For few input fields like "Z" . It is showing all the output values at Trace. But when I go and place a value in lookup table for the same Input field "Z" . this new value is not coming up at trace Level while rest of teh values are coming up. Can anyone hint where I am going wrong  ?
    End to end Debugging sahows values populating and being sent across . Where I need to look at ?
    Regards ,
    Santosh

    Hi Horia ,
    By trace do you mean display queue or running the mapping completely in the ESR ?
    --->I am talking about running the mapping at IR and getting the values of trace by using messagetype.traceinfo() in UDF functionality. I am working on Pi 7.0
    Regards ,
    Santosh

Maybe you are looking for

  • Outlook messag folder exported opens with no content in outlook 2010

    I followed steps to export a folder in Outlook to pst file, the file appeared on desktop.  But when I open the pst file using Outlook File >Open, it shows no content (the original folder has a few messages) Does anyone know why ? Appreciate any advis

  • PreparedStatement and LIKE

    Can I use LIKE in a preparedStatement? String selectTwo = "SELECT zip_code " + "FROM alk_zip " + "WHERE zip_code LIKE ? " + "ORDER BY zip_code"; PreparedStatement stmtTwo = con.prepareStatement( selectTwo ); // loop starts here stmtTwo.setString( 1,

  • SAP BusinessObjects XI 3.1 Download

    Dear Experts, can anybody help in downloading the latest version? I tried to follow this path on services.sap.com : SAP BusinessObjects portfolio >> SBOP ENTERPRISE >> BOBJ ENTERPRISE XI 3.1 Unfortunately I'm not sure which one to download. The most

  • ECC 5.0 and EP7.0 SP9 compatible

    Hi Experts, I am trying to implement ESS and MSS on ERP2004 and NW2004s SP09 (EP7.0) SP09. are the versions supported? where can i find the respective XSS component versions for EP7.0 SP9? to implement the BPs ESS 60.2, the online documentation says.

  • I can't install wli sp2 with wls sp4

    I try to install wlintegration sp2 with wlserver sp4 on HP UX 11 and when I select the bea home directory, this message appear: WebLogic Server 6.1 SP 2 is a prerequisite for this installation. You do not seem to have it installed to /opt/bea: What c