Trynig to access a variable in another mxml

Hi All,
I'm looking for some guidance here as I am new to Flex. I
have a datagrid with two colums at the end that contain item
renderers. The idea is to allow the user to cick an edit or delete
icon to edit or delete that row. I"m using a component mxml file
for each renderer and can not figure out how to access values from
the calling application. Since all my web service code etc. is in
the parent application, I need to figure out how to access it.
I have been reading various books and blogs and have tried
setting up an event handler in both mxml files but I am unable to
get the parent mxml to get the event. Below is some sample code.
Any ideas?
This is the component mxml file . . .
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="
http://www.adobe.com/2006/mxml"
horizontalAlign="center">
<mx:Metadata>
[Event( name = "editCurrentHandler", type =
"flash.events.Event" ) ]
</mx:Metadata>
<mx:Script>
<![CDATA[
private function clickHandler() : void
import mx.controls.Alert;
Alert.show( "Called clickHandler in edit item renderer" );
var eventObj:Event = new Event( "editCurrentHandler" );
dispatchEvent( eventObj );
]]>
</mx:Script>
<mx:Image id="imageDelete" source="images/bluepencil.gif"
width="20" click="clickHandler()"/>
</mx:HBox>
This is an excerpt of the parent mxml file . . .
private function initApp() : void
wsProjectInformation.getControlsProjects.send();
addEventListener( "editCurrentHandler", editCurrentHandler
addEventListener( "deleteCurrentHandler",
deleteCurrentHandler );
public function editCurrentHandler() : void
Alert.show( "Edit was clicked!" );
public function deleteCurrentHandler() : void
Alert.show( "Delete was clicked!" );
<mx:DataGrid id="dataGridDeliverables" visible="false"
dataProvider="{wsProjectInformation.getProjectDeliverableDocuments.lastResult}"
change="getProjectTasks()">
<mx:columns>
<mx:DataGridColumn headerText="ID #"
dataField="projectDeliverableID" width="50"/>
<mx:DataGridColumn headerText="Description"
dataField="projectDeliverableName" width="200"/>
<mx:DataGridColumn headerText="Est. Hours"
dataField="projectEstHours" width="80"/>
<mx:DataGridColumn headerText="Est. Dollars"
dataField="projectEstDollars" width="80"/>
<mx:DataGridColumn width="20"
itemRenderer="com.psc.components.editRenderer"/>
<mx:DataGridColumn width="20"
itemRenderer="com.psc.components.deleteRenderer"/>
</mx:columns>
</mx:DataGrid>

I don't mean to be a pest but I'm still struggling with this.
. .I must be a goof but when I do that, the event comes from my
data grid not my item renderer.
<mx:DataGrid id="dataGridDeliverables" visible="false"
dataProvider="{wsProjectInformation.getProjectDeliverableDocuments.lastResult}"
click="dgDeliverableClickHandler( event )">
<mx:columns>
<mx:DataGridColumn headerText="ID #"
dataField="projectDeliverableID" width="50"/>
<mx:DataGridColumn headerText="Description"
dataField="projectDeliverableName" width="200"/>
<mx:DataGridColumn headerText="Est. Hours"
dataField="projectEstHours" width="80"/>
<mx:DataGridColumn headerText="Est. Dollars"
dataField="projectEstDollars" width="80"/>
<mx:DataGridColumn width="20"
itemRenderer="com.psc.components.editRenderer"/>
<mx:DataGridColumn width="20"
itemRenderer="com.psc.components.deleteRenderer"/>
</mx:columns>
</mx:DataGrid>
private function dgDeliverableClickHandler( event:Event ) :
void
if( event.currentTarget.id == "imageEdit" )
editCurrentHandler();
else if( event.currentTarget.id == "imageDelete" )
deleteCurrentHandler();
else
getProjectTasks();
private function editCurrentHandler() : void
Alert.show( "Edit was clicked!" );
private function deleteCurrentHandler() : void
Alert.show( "Delete was clicked!" );

Similar Messages

  • How to access a variable from one mxml to another mxml?

    I have Vbox having Hbox in turn hbox has some components ...TextInput...
    I m adding this Vbox in another mxml file....iteratively ....
    I need the sum of all the enetered values in the text boxes to be displayed on the textbox in another Mxml ...
    I am taking sum in a variable and want to show tha some in another file...
    How can I get that variable in my resultant mxml??
    TIA

    In this case it is best to use custom events to pass data. Here are some resources:
    http://chikaradev.com/learning/flex3/customevents/StudentsTutoringCustomEvents1.pdf
    http://chikaradev.com/learning/flex3/customevents/CustomEvents3/CustomEvents3.html
    http://livedocs.adobe.com/flex/3/html/help.html?content=createevents_3.html
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex / AIR Development, Training, and Support Services

  • HOw to access a variable in another scriptlet ?

    I declare a integer variable and want to access it in another sciptlet in the same page.That scriplet is to display a value in a table.
    The table is in a top level loop.I want to update the same variable in inner loop so that when I again go to the top level loop I should be able to get the updated value.

    Think of scriptlets as small sections of code within the same method. The entire JSP is one method, and your scriptlets are executed within that method just like it normally would. All HTML gets basically broken down into out.println(String) calls wrapped around any scriptlet calls. So if you had this
    bunch of HTML
    <% int bob; %>
    bunch of HTML
    <%for(; bob < 10; bob++)
    %>
    bunch of HTML
    <%
    %>That gets translated into
    out.println("bunch of HTML");
    int bob ;
    out.println("bunch of HTML");
    for(;bob < 10; bob++ )
        out.println("bunch of HTML");
    }

  • Accessing a Variable from another component

    Hey,
    I have got a main application with different states.. in the
    states I call different components.
    like this:
    quote:
    <mx:State name="products">
    <mx:AddChild>
    <modules:Products/>
    </mx:AddChild>
    </mx:State>
    <mx:State name="add_offer">
    <mx:AddChild>
    <modules:AddOffer bufferedProduct="{}" />
    </mx:AddChild>
    </mx:State>
    In the product component, I have a button which saves some
    information to a variable called "bufferedProduct". after that the
    program leaves the state "products" und switches to the state
    "add_offer", which is a different component. There I need the saved
    information from the "bufferedProduct" variable.
    Now my question, how can I "transfer" the information
    previously stored within the "Products" component in the
    "bufferedProduct" var into the "addOffer" component? Is there a way
    I can do that? Or should I use a different way to build my
    application :)
    this does not work unfurtunately!
    quote:
    parentDocument.products.bufferedProduct
    thx in advance
    pat

    Hey,
    I actually found one answer myself.
    I created a var bufferedProduct in the main app. In te
    Products state, I save the information to
    "parentDocument.bufferedProduct" and then I sent the var to the
    other component like this
    quote:
    <modules:AddOffer bufferedProduct="{bufferedProduct}"
    />
    in the addOffer component I just had to declare another var
    with the same name and thats it.
    thx anyway.
    pat

  • Accessing a variable from another script

    Is it possible to create a global variable in VB in the Job VBA code and to access it from VB in the scripts contained in that job? I want to dynamically create a value (a random email address) for use in one script where it is used for registration and then use it again in a second script for login.

    I had a similar requirement and used a slightly different approach to solve it.
    I had to produce some random char strings that would be client IDs to create test client records in my web app. I needed to reference these random client IDs in both a create script and a modify script.
    I found that (and I guess this can come down to personal preference) it was easy to create a "utility function" that writes a file with however many random strings you want in csv format. If your target scripts don't have databanks, just play this sub in the VBA editor, and then throw the output file into the databank folder and databank the field of interest. For subsequent runs, just play the sub in the VBA editor for fresh data. Worst case, you have an existing databank, and you just need to paste this file into it in excel as a new column. Not a big deal. Here's an example of a function I have that I changed such that it would create a list of random email addresses to a csv file everytime you run the sub in VBA. Just drop this in your VBA workspace sharedmodule:
    Private Sub CreateMemberEmailFile()
    Dim intA As Integer
    Dim sngA As Single
    Dim strA As String
    'Dim x As Integer
    Dim str As String
    Dim answer As Boolean
    Dim fs As Scripting.FileSystemObject
    Dim myfile As Scripting.TextStream
    Set fs = New Scripting.FileSystemObject 'Create a new file system object
    ' put the file anywhere you want, doesnt matter
    Set myfile = fs.OpenTextFile("c:\memberemailid.csv", ForWriting)
    myfile.WriteLine "MemberEmailID"
    ' ok, this creates 50 random emails...feel free to change 50 to whatever you desire
    For y = 1 To 50
    str = ""
    For x = 0 To 9
    'sngA = Rnd
    'Select Case (CInt(sngA * 200) Mod 3)
    ' Case 0
    ' intA = CInt(sngA * 48) + CInt(sngA * 10)
    ' intA = 48 + (intA Mod 10)
    'Case 1
    ' intA = CInt(sngA * 65) + CInt(sngA * 26)
    ' intA = 65 + (intA Mod 26)
    'Case 2
    ' intA = CInt(sngA * 97) + CInt(sngA * 26)
    ' intA = 97 + (intA Mod 26)
    'End Select
    'make intA a random number from 0-9
    intA = RandNum(0, 9)
    strA = CStr(intA)
    str = str & strA
    Next x
    str = str & "@test.com"
    myfile.WriteLine str 'write the message to identify a different line
    Next y
    myfile.Close 'Close the file
    Set myfile = Nothing ' Release the variables
    Set fsoData = Nothing ' Release the variables
    End Sub

  • How to access the element of one mxml to another mxml?

    Hi,
    I have a component named storylist as below in StoryList.mxml
    <mx:List id="storyList" width="100%" dataProvider="{this.currentDoc.stories}" height="100%" variableRowHeight="true" selectable="false" borderStyle="none"
    itemRenderer="com.xxx.yyy.core.views.renderers.StoryRenderer">
    </mx:List>
    I want to access the storylist in another mxml CoreCanvas.mxml
    private function onOpenFile (doc:IdmlDocument):void {
    logger.info("onOpenFile");
    this.editor.currentDoc = doc;
    this.editor.storyList.dataProvider = this.editor.currentDoc.stories;
    but when  i declared as a bindable variable in StoryList.mxml --> [Bindable] public varstoryList:IdmlStory = null;
    it gives an error
    Description Resource Path Location Type
    1151: A conflict exists with definition storyList in namespace internal. StoryList.mxml/WebEditorCore/src/com/xxx/yyy/core/views/editor line 10 Flex Problem
    how can i access storylist in the other mxml file?
    Message was edited by: Jochem van Dieten

    I'm a bit confused about this design approach.
    [Bindable] public var storyList:IdmlStory = null; 
    The reason why the above line fails to compile in StoryList.mxml is that a variable of the same name already exists. You have specified a List with an id of storyList. The translation process will yield:
    var storyList:List = new List();
    and then fill in the properties.

  • Accessing public variables from other classes

    Probably a simple questions, but how can I access a variable from another class. My exact situation is as follows.
    A class called WorldCalender has a variable which is defined: public int hour; (the value is given to it elsewhere).
    I want to access this variable and increase it by one in a subroutine in the class Hour. In this class I have put: WorldCalender.hour++; but it doesn't seem to work. How should I do it?

    don't expose the hour variable at all.
    have a method eg addToHourBy( int hrs )
    Probably a simple questions, but how can I access a
    variable from another class. My exact situation is as
    follows.
    A class called WorldCalender has a variable which is
    defined: public int hour; (the value is given to it
    elsewhere).
    I want to access this variable and increase it by one
    in a subroutine in the class Hour. In this class I
    have put: WorldCalender.hour++; but it doesn't seem to
    work. How should I do it?

  • Accessing a variable defined in one class from another class..

    Greetings,
    I've only been programming in as3 for a couple months, and so far I've written several compositional classes that take MovieClips as inputs to handle behaviors and interactions in a simple game I'm creating. One problem I keep coming upon is that I'd love to access the custom variables I define within one class from another class. In the game I'm creating, Main.as is my document class, from which I invoke a class called 'Level1.as' which invokes all the other classes I've written.
    Below I've pasted my class 'DieLikeThePhishes'. For example, I would love to know the syntax for accessing the boolean variable 'phish1BeenHit' (line 31) from another class. I've tried the dot syntax you would use to access a MovieClip inside another MovieClip and it doesn't seem  to be working for me. Any ideas would be appreciated.  Thanks,
    - Jeremy
    package  jab.enemy
    import flash.display.MovieClip;
    import flash.events.Event;
    import jab.enemy.MissleDisappear;
    public class DieLikeThePhishes
    private var _clip2:MovieClip; // player
    private var _clip3:MovieClip; //phish1
    private var _clip4:MovieClip; //phish2
    private var _clip5:MovieClip; //phish3
    private var _clip6:MovieClip; //phish4
    private var _clip10:MovieClip; // background
    private var _clip11:MovieClip // missle1
    private var _clip12:MovieClip // missle2
    private var _clip13:MovieClip // missle3
    private var _clip14:MovieClip // missle4
    private var _clip15:MovieClip // missle5
    private var _clip16:MovieClip // missle6
    private var _clip17:MovieClip // missle7
    private var _clip18:MovieClip // missle8
    private var _clip19:MovieClip // missle9
    private var _clip20:MovieClip // missle10
    private var _clip21:MovieClip // missle11
    private var _clip22:MovieClip // missle12
    var ay1 = 0;var ay2 = 0;var ay3 = 0;var ay4 = 0;
    var vy1 = 0;var vy2 = 0;var vy3 = 0;var vy4 = 0;
    var phish1BeenHit:Boolean = false;var phish2BeenHit:Boolean = false;
    var phish3BeenHit:Boolean = false;var phish4BeenHit:Boolean = false;
    public function DieLikeThePhishes(clip2:MovieClip,clip3:MovieClip,clip4:MovieClip,clip5:MovieClip,clip6:M ovieClip,clip10:MovieClip,clip11:MovieClip,clip12:MovieClip,clip13:MovieClip,clip14:MovieC lip,clip15:MovieClip,clip16:MovieClip,clip17:MovieClip,clip18:MovieClip,clip19:MovieClip,c lip20:MovieClip,clip21:MovieClip,clip22:MovieClip)
    _clip2 = clip2;_clip3 = clip3;_clip4 = clip4;_clip5 = clip5;_clip6 = clip6;
    _clip10 = clip10;_clip11 = clip11;_clip12 = clip12;_clip13 = clip13;_clip14 = clip14;
    _clip15 = clip15;_clip16 = clip16;_clip17 = clip17;_clip18 = clip18;_clip19 = clip19;
    _clip20 = clip20;_clip21 = clip21;_clip22= clip22;
    _clip3.stage.addEventListener(Event.ENTER_FRAME, onEnterFrame)
    function onEnterFrame(event:Event):void
    vy1+= ay1;_clip3.y += vy1; vy2+= ay2;_clip4.y += vy2;
    vy3+= ay3;_clip5.y += vy3; vy4+= ay4;_clip6.y += vy4;
    if (phish1BeenHit ==false)
    if(_clip3.y >620)
    {_clip3.y = 620;}
    if (phish2BeenHit ==false)
    if(_clip4.y >620)
    {_clip4.y = 620;}
    if (phish3BeenHit ==false)
    if(_clip5.y >620)
    {_clip5.y = 620;}
    if (phish4BeenHit ==false)
    if(_clip6.y >620)
    {_clip6.y = 620;}
    if (_clip11.hitTestObject(_clip3) ||_clip12.hitTestObject(_clip3)||_clip13.hitTestObject(_clip3)||_clip14.hitTestObject(_cl ip3)||_clip15.hitTestObject(_clip3)||_clip16.hitTestObject(_clip3)||_clip17.hitTestObject( _clip3)||_clip18.hitTestObject(_clip3)||_clip19.hitTestObject(_clip3)||_clip20.hitTestObje ct(_clip3)||_clip21.hitTestObject(_clip3)||_clip22.hitTestObject(_clip3))
    _clip3.scaleY = -Math.abs(_clip3.scaleY);
    _clip3.alpha = 0.4;
    ay1 = 3
    vy1= -2;
    phish1BeenHit = true;
    if (_clip11.hitTestObject(_clip4) ||_clip12.hitTestObject(_clip4)||_clip13.hitTestObject(_clip4)||_clip14.hitTestObject(_cl ip4)||_clip15.hitTestObject(_clip4)||_clip16.hitTestObject(_clip4)||_clip17.hitTestObject( _clip4)||_clip18.hitTestObject(_clip4)||_clip19.hitTestObject(_clip4)||_clip20.hitTestObje ct(_clip4)||_clip21.hitTestObject(_clip4)||_clip22.hitTestObject(_clip4))
    _clip4.scaleY = -Math.abs(_clip4.scaleY);
    _clip4.alpha = 0.4;
    ay2 = 3
    vy2= -2;
    phish2BeenHit = true;
    if (_clip11.hitTestObject(_clip5) ||_clip12.hitTestObject(_clip5)||_clip13.hitTestObject(_clip5)||_clip14.hitTestObject(_cl ip5)||_clip15.hitTestObject(_clip5)||_clip16.hitTestObject(_clip5)||_clip17.hitTestObject( _clip5)||_clip18.hitTestObject(_clip5)||_clip19.hitTestObject(_clip5)||_clip20.hitTestObje ct(_clip5)||_clip21.hitTestObject(_clip5)||_clip22.hitTestObject(_clip5))
    _clip5.scaleY = -Math.abs(_clip5.scaleY);
    _clip5.alpha = 0.4;
    ay3 = 3
    vy3= -2;
    phish3BeenHit = true;
    if (_clip11.hitTestObject(_clip6) ||_clip12.hitTestObject(_clip6)||_clip13.hitTestObject(_clip6)||_clip14.hitTestObject(_cl ip6)||_clip15.hitTestObject(_clip6)||_clip16.hitTestObject(_clip6)||_clip17.hitTestObject( _clip6)||_clip18.hitTestObject(_clip6)||_clip19.hitTestObject(_clip6)||_clip20.hitTestObje ct(_clip6)||_clip21.hitTestObject(_clip6)||_clip22.hitTestObject(_clip6))
    _clip6.scaleY = -Math.abs(_clip6.scaleY);
    _clip6.alpha = 0.4;
    ay4 = 3
    vy4= -2;
    phish4BeenHit = true;
    if (_clip3.y > 10000)
    _clip3.x = 1000 +3000*Math.random()-_clip10.x;
    _clip3.y = 300;
    _clip3.alpha = 1;
    _clip3.scaleY = Math.abs(_clip3.scaleY);
    ay1 = vy1 = 0;
    phish1BeenHit = false;
    if (_clip4.y > 10000)
    _clip4.x = 1000 +3000*Math.random()-_clip10.x;
    _clip4.y = 300;
    _clip4.alpha = 1;
    _clip4.scaleY = Math.abs(_clip4.scaleY);
    ay2 = vy2 = 0;
    phish2BeenHit = false;
    if (_clip5.y > 10000)
    _clip5.x = 1000 +3000*Math.random()-_clip10.x;
    _clip5.y = 300;
    _clip5.alpha = 1;
    _clip5.scaleY = Math.abs(_clip5.scaleY);
    ay3 = vy3 = 0;
    phish3BeenHit = false;
    if (_clip6.y > 10000)
    _clip6.x = 1000 +3000*Math.random()-_clip10.x;
    _clip6.y = 300;
    _clip6.alpha = 1;
    _clip6.scaleY = Math.abs(_clip6.scaleY);
    ay4 = vy4 = 0;
    phish4BeenHit = false;
    var missleDisappear1 = new MissleDisappear(_clip11,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear2 = new MissleDisappear(_clip12,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear3 = new MissleDisappear(_clip13,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear4 = new MissleDisappear(_clip14,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear5 = new MissleDisappear(_clip15,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear6 = new MissleDisappear(_clip16,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear7 = new MissleDisappear(_clip17,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear8 = new MissleDisappear(_clip18,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear9 = new MissleDisappear(_clip19,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear10 = new MissleDisappear(_clip20,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear11 = new MissleDisappear(_clip21,_clip3,_clip4,_clip5,_clip6,_clip10);
    var missleDisappear12 = new MissleDisappear(_clip22,_clip3,_clip4,_clip5,_clip6,_clip10);

    I would approach it in much the same way as you would in java, by making getters and setters for all of your class variables.
    Getters being for returning the values, Setters being for setting them.
    So you would make a get function for the variable you want to access ala:
    function get1PhishBeenHit():boolean {
         return this.phish1BeenHit;
    Then to access the value of that variable from outwith the class:
    var result:boolean = ClassInstanceName.get1PhishBeenHit();

  • How to access the component id from another mxml?

    I tried to set the data to a DataGrid in another mxml, but the complier said there's a problem, like this:
    the components/FileDataGrid.mxml:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/mx" >
        <mx:DataGrid x="150" y="50" id="dgFile">       <mx:columns>
             <mx:DataGridColumn headerText="COL"/>
           </mx:columns>
        </mx:DataGrid>
    </s:Group>
    the main mxml:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
              xmlns:s="library://ns.adobe.com/flex/spark"
              xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
              xmlns:custom="components.*" layout="absolute">
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <fx:Script>
              <![CDATA[
                   private function loadDG():void
                        var arrFile:Array= new Array("abc","123");
                        dgFile.dataProvider = arrFile;
                        trace( "The data has successfully loaded" );
              ]]>
         </fx:Script>
         <s:Button  x="300" y="50" label="Load"  click="loadDG()" />
         <custom:FileDataGrid/>
    </mx:Application>
    The compiling error is :
    Multiple markers at this line:
    -1120: Access of undefined property dgFile.
    -arrFile
    Anybody can tell me, how to achieve it?
    Thanks a lot!

    Hi, You cant access it like this. To access, first give some id to the custom component you have added.
    i.e
    <custom:FileDataGrid id="custFDG"/>
    Then you can acces it from script,
    custFDG.dgFile.dataProvider = arrFile;
    Hope this shud work fine.
    Thanks.
    Abhinav

  • Accessing another variable from another application

    I was wonder how I can access another variable form another application?
    For example: I want to access :P4_EMPLOYEE_NAME from app ID 104 when I am doing is from an activity in page 2 on app ID 142.
    I had a search before, but I am looking for an unambiguous response.

    Greg - About all you can do is call the function htmldb_util.fetch_app_item(p_item => 'F104_ITEM', p_app => '104'). The application you call this function in must be sharing a session with the application from which you are fetching the item, both applications must belong to the same workspace, and the item you name in the argument must be defined as an application-level item in the fetched-from application.
    Scott

  • Can one obj access a private variable of another obj of the same class

    Can one object access a private variable of another object of the same class?
    If so, how?

    Declaring variable private means you can not access this variable outside class
    But other objects of same class can access it. Because each object have separate copy of variable and may have diff. contents for same variable.

  • Accessing variable in main mxml from component

    I have the following problem, i have a main mxml and
    component mxml which i import in my main file. I need to access
    variable in main mxml file from that component but i don't know how
    to reference my main mxml from component? Can someone please help
    me with this?
    thanks in advance

    Try this
    this.parentApplication.main_mxml.variableID = 34;
    Rgds
    JFB
    "msabljic" <[email protected]> wrote in
    message
    news:fd2u5k$a17$[email protected]..
    >I have the following problem, i have a main mxml and
    component mxml which i
    > import in my main file. I need to access variable in
    main mxml file from
    > that
    > component but i don't know how to reference my main mxml
    from component?
    > Can
    > someone please help me with this?
    >
    > thanks in advance
    >

  • Accessing variable from another class

    Say I want to access String ABC from class XYZ from my main class. I have already created the object for the class I just don't know the syntax for accessing the variable.
    This is just an example. I figured this is just a problem of finding the right syntax so I didn't bother creating a compiling code.
    public class test{
    public static void main(String[]args){
         XYZ xyz = new XYZ ();
         String a = abc.XYZ(); // this is where i want to directly access the variable abc. i know this isn't correct and it's what im trying to find out how to do.
    public class XYZ{
         String abc = "hi";
    }Edited by: aznprdgy on Nov 3, 2009 2:13 PM

    No, that isn't possible.
    abc is said to be a local variable. And it's only useable within method().
    It's part of the job of the class Xyz to control the access to its state. As an example:
    public class Test {
        public static void main(String[] args) {
            Xyz xyz = new Xyz()
            String a = xyz.getSpecialValue();
    public class Xyz {
        private String a;
        public String getSpecialValue() {
            return a;
        public void method() {
            a = "hi";
    }Note that a won't be reference to the string "hi" until after method() has been called.

  • Accessing variable from another JSP

    Friends,
    say, I have a Test1.jsp which has a variable "input". Is it possible to access this variable from other jsp "Test2.jsp"?
    any ideas?
    Thanks
    Hari V

    hi hari,
    there are essentially 3 ways of doing it....
    1).Usage of Hidden Values
    2).Using Cookies
    3).Storing attribute value within the scope of request/session/appln
    The choice is all urs....???
    Regards,
    RAHUL

  • How to access the datagrid in one mxml in another component

    I have a datagrid in a.mxml. when click on the add button, it comes to a b.as file (not a class) to do some things and then, b.as call a popupwindow (c.mxml) to add a row into table (call backend). After I added the row to database table successfully, I want to add the row into datagrid to display, but I could not access the datagrid in a.mxml from c.mxml. How can I do this?
    Thank you in advance.

    If this post answers your question or helps, please mark it as such.
    To add a row to the DataGrid you really need to just add data to the dataProvider collection object.
    You can access components by going through the main app:
    mx.core.Application.application.myA.myVar = myC.cVar;
    But you should really be using custom events to communicate between components, though it is more complex. Here is my Flex 3 Cookbook post of the topic of custom events:
    http://cookbooks.adobe.com/post_Building_a_wizard_using_a_simplified_MVC_architect-11246.h tml
    Here are some sample apps on custom events on my web site (right click to View Source):
    http://www.chikaradev.com/learning/flex3/customevents/CustomEventSimple/CustomEventSimple. html
    http://www.chikaradev.com/learning/flex3/customevents/CustomEvents1/index.html
    http://www.chikaradev.com/learning/flex3/customevents/CustomEvents2/CustomEvents2.html
    http://www.chikaradev.com/learning/flex3/customevents/CustomEvents3/CustomEvents3.html
    Here is my tutorial on custom events:
    http://www.chikaradev.com/learning/flex3/customevents/StudentsTutoringCustomEvents1.pdf

Maybe you are looking for

  • Want to install Windows 7 64 bit to DV4T-5200

    I'll keep it short - my wife hates Windows 8.  She also hates 8.1.   I am trying to install Windows 7 64 bit to her DV4T-5200 laptop, and I have never had so much trouble getting an OS installed before.  Does anyone know what BIOS settings I need to

  • Purchase order release workflow - urgent

    Hi friends When iam creating purchase order it trigger the workflow WS20000075 for releasing purchase order in that purpose what can i do.. How can i set the Agents How can i trigger the events - i think in that purpose using pftc we trigger the work

  • Font problems in resulting XML Publisher document (from PeopleSoft)

    Hi all, we're creating documents using XML Publisher under PeopleSoft, designing the template in Word 2007. We see strange things hapening to the resulting documents: even though the majority of the template is created in a Times New Roman 11pt font,

  • How can I quantize particle movement?

    I have a particle system of rectangles and have them moving exactly the way I want with one exception.  I would like the particles to move so that their position is quantized with an 40 px step along the y-axis each time.  When a typical object is an

  • Unable to see 2nd and 3rd pages on the report

    Hi - I am facing an issue while developing a simple report. This report is based on a table called PROD. DDL statement of PROD is: CREATE TABLE PROD    (PID VARCHAR2(6),     PNAME VARCHAR2(6),     PCOST NUMBER(4,2),     PPROFIT NUMBER(3,0),     CONST