Public vars as 3

We have an issue as follows ::
The textfield of each button has to take the category names of an xml file...
So we needs three variables that they take the category text from an xml and then we need to put this text to the textfield
But the textfields of each button are on other pages and they are not in the public one..so we need a public / public variables that are visible everywhere..
we searched and we found that in each variabkle you add something like (public var i = cat;) but in order to make a variable public i need to import a package {public var butext:String;} ?that  i cant import because i am getting (syntax error package is unexpected)
The package is {public var butext:String;} we are using flash cs4 and action script 3
Many Thanks
Ivan

hi,
     public var in AS3 only for using a Package......
     So you need to create a package.......
     do you want example for package?
Regards
Kamal

Similar Messages

  • Binding node value from public var

    Hi,
    I am developing an interface between an axis web service and flex.
    I must create a custom soap message, so I have define:
    CDATA
    [Bindable] public var name:String = "PRUEBAS";
        <mx:request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:loc="http://XXXXXXXXX/"
                  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                       format="xml">
             <loc:DarWeb soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
             <in0 xsi:type="loc:Elem" xmlns:dat="http://XXXXXX">
                <original xsi:type="xsd:string">{name}</original> IT DOES NOT TAKE THE VALUE OF THE BINDING VAR
           </in0>
    Please, someone who knows how to get the value of the var?
    PD: In compilation time I have the next warning:  "data binding will not be able to detect assignments to ..."
    Thanks in advance
    Fran

    Thanks for your reply williams. I will try to explain better.
    I have an action script class called Name with the next attribs:
      public class Name
             [Bindable] public var name:String;
             [Bindable] public var ape1:String;
             [Bindable] public var cp:String;
          public function Name()
                      //nothing initialize   
    In my mxml I have
    <mx:Script>
        <![CDATA[
        [Bindable] public var nombre:Name = new Name();
        ]]>
    </mx:Script>
    And the last code that are involve in my problem is the next one:
    <mx:WebService id="webService" wsdl="XXXX (local wsdl)" showBusyCursor="true">
        <mx:operation name="getNames"
                    resultFormat="e4x"
                    result="handleResponse(event);"
                    fault="handleFault(event);">
              <mx:request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:name="http://XXXXXXX"
                  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                       format="xml">
                  <name:getNames soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
                       <in1 xsi:type="name:Name" xmlns:name="http://XXXXXX">
                          <name xsi:type="xsd:string"> {nombre.name}</name><!-- value from class-->
                          <ape1 xsi:type="xsd:string">{nombre.ape1}</ape1><!-- value from class-->
                          <cp xsi:type="xsd:string">{nombre.cp}</cp><!-- value from class-->
                       </in1>
               </name:getNames>               
             </mx:request>
              </mx:operation>
        </mx:WebService>
    I can not retrieve class attribute´s values, so the xml nodes are null.
    Thanks a lot for those who reply.
    Fran

  • Add public var to skin class

    hello
    i'm new with sdk 4
    i have a problem with skin class , i'll go creazy ;-)
    i wouldlike pass data to my instance skin class , for example i wouldlike get "test"
    my skin class :
    <?xml version="1.0" encoding="utf-8"?>
    <s:Skin xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:components="components.*"
           >
        <fx:Metadata>[HostComponent("spark.components.SkinnableContainer")]</fx:Metadata>
        <fx:Script>
            <![CDATA[
                [Bindable]
                public var test :Object;
            ]]>
        </fx:Script>
        <s:states>
            <s:State name="normal"/>
            <s:State name="disabled"/>
        </s:states>
        <s:Rect height="312" radiusX="10" width="449" x="2.5" y="2.5">
            <s:stroke>
                <s:SolidColorStroke caps="none" color="#5380D0" joints="miter" miterLimit="4" weight="5"/>
            </s:stroke>
            <s:fill>
                <s:SolidColor color="#AF0000"/>
            </s:fill>
        </s:Rect>
        <s:Label>
        </s:Label>
        <s:VScrollBar height="200" width="15" x="231" y="98" viewport="{contentGroup}"/>
        <components:ScrollingContent1 x="75" y="94" id="contentGroup" mytext="{test}" clipAndEnableScrolling="true" width="156" height="204"/>
    </s:Skin>
    from my main app i try to pass data to "test" in skin class:
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:d="http://ns.adobe.com/fxg/2008/dt"
                   xmlns:fc="http://ns.adobe.com/flashcatalyst/2009"
                   backgroundColor="#FFFFFF" height="600" preloaderChromeColor="#FFFFFF" width="800"
                   creationComplete="onInit()">
            <s:SkinnableContainer id="mySkinContainer" test="bruno"     skinClass="components.ScrollPanel1" x="179" y="65"/>
    it doesn't work , i tried another thing , but never good result.
    thank for your help

    You've defined test on the skin, not on the component.  You can follow our
    patterns of proxying properties to the skin.   Just about any property on
    our SkinnableComponents should be an accurate model.
    Or cheat and try:
            <s:SkinnableContainer id="mySkinContainer"
    skinChanged="mySkinContainer.skin['test'] = bruno" 

  • Public var and External swf

    Hello!
    I have some problem with vars. The situation is the same I wrote here Re: External swf
    I have public var (for example ZZZ) in code of MAIN.swf (main class is Main.as), and I want to access it from code of loaded EXTERNAL.swf.
    But nothing helps, flash says:
    there is no ZZZ in code of Main
    there is no ZZZ on stage.root
    there is no ZZZ in any parents.
    But if a have ZZZ in code of EXTERNAL, and want to access it from MAIN,  (the reverse situation), ZZZ is easily found.

    Worked that:
    I should pass to EXTERNAL
    this
    as exact pass, and then
    ExactPass.ZZZ
    would be found
    in External:
    public var GAME_MAIN_CODE:*;
    in Main:
    EXTERNAL.GAME_MAIN_CODE = this;
    Thank you for help!

  • Public var for code in main Fla movieClip plz help!

    Hi there,
    I've made a basic memory game where you have to match up shapes and pictures. but now Im trying to get it to be slightly more complex.
    I have a set of shapes and each shape has a different color. What im trying to achieve is for all the shapes to come up as one color.
    The colors are nested inside each movieClip of the shape.
    first level got 6 cards all the same movieclip but different instence name.
    the problem is that each card comes up with a different color:
    Code in Class:
    public static var curFrame = Math.floor(Math.random() * 6) + 1;
    Code in Fla on the key frame of each shape inside each movie clip:
    trace("***************shape1********************"+memC.curFrame)
    Shape1.gotoAndStop(memC.curFrame);
    And this in the first key frame:
    stop();
    var memC: memory_Control = new memory_Control
    Basically:
    Movieclips (6 cards) - in each there are 8 different shapes - each shape has 5 key frames for different colors.
    If you can help ill rly appriciate it
    thx pavel

    while(!answer.equalsIgnoreCase("q"));

  • How make class w/public var like "length" in array? i.e. final, set at init

    In any array, you get the length of it by calling "MyArray.length". length is a public variable, but it cannot be set. If you try:
    String[] str = { "ss" };
    str.length = 2;
    you'll get an error saying you can't change a final variable.
    So my question is, how to I make a variable final, but not set it until initialization?

    but i meant, if it's final, why can it be set at all
    after compile?How final is used, from the Java tutorial:
    http://java.sun.com/docs/books/tutorial/java/nutsandbolts/finalVariables.html

  • How can I call a public function in one component from another component?

    I have two components: Form and Confirmation.  Form is a Canvas and Confirmation is a TitleWindow.
    Form contains several controls and a submit button.  Confirmation contains an OK button.  When the user clicks the submit button, the Confirmation appears over the Form (Form is blurred).  When the user clicks the OK button on the Confirmation, I want to run a function on Form to set some default values in the controls.
    How can I address the function in the Form component from the Confirmation component so I can fire the function?
    Thanks!

    Here is the source
    CustomForm.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
    <mx:Script>
    <![CDATA[
    public function callBack(): void {
    lblStatus.text = "Success";
    ]]>
    </mx:Script>
    <mx:Label id="lblStatus"/>
    <mx:Form x="50" y="50" verticalGap="15">
            <mx:FormHeading label="Send us comments" />
            <mx:FormItem label="Full Name:">
                <mx:TextInput id="fullName" />
            </mx:FormItem>
            <mx:FormItem label="Email:">
                <mx:TextInput id="email" />
            </mx:FormItem>
            <mx:FormItem label="Comments:">
                <mx:TextArea id="comments" />
            </mx:FormItem>
            <mx:FormItem>
                <mx:Button id="submit"
                    label="Submit" />
            </mx:FormItem>
         </mx:Form>
    </mx:Canvas>
    CustomTitle.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute" width="200" height="80"
    showCloseButton="true" close="closeMe(event)"
    backgroundAlpha="1"
    color="#173553" backgroundColor="#EEEEEE"
    headerColors="#FFFFFF, #CBCCCC"
    borderColor="#666666" borderStyle="solid">
    <mx:Script>
    <![CDATA[
    import mx.managers.PopUpManager;
    public var callBack: Function = new Function();
    private function closeMe(event: Event): void {
    PopUpManager.removePopUp(this);
    callBack();
    ]]>
    </mx:Script>
    <mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="bottom">
    <mx:Button id="btnOK" label="OK" click="closeMe(event)" />
    </mx:HBox>
    </mx:TitleWindow>
    TitleWindowSample.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns="*"
    layout="absolute"
    width="100%" height="100%"
    creationComplete="init()">
    <mx:Script>
    <![CDATA[
    import mx.managers.PopUpManager;
    private function init(): void {
    customForm.submit.addEventListener(MouseEvent.CLICK, onMouseClick);
    private function onMouseClick(event: MouseEvent): void {
    customForm.lblStatus.text = "";
    var customTitle: CustomTitle = new CustomTitle();
    customTitle.callBack = customForm.callBack;
    PopUpManager.addPopUp(customTitle, this);
    PopUpManager.centerPopUp(customTitle);
    ]]>
    </mx:Script>
    <mx:VBox
    width="100%" height="100%"
    verticalAlign="middle" horizontalAlign="center">
    <CustomForm id="customForm" width="500" height="300">
    </CustomForm>
    </mx:VBox>
    </mx:Application>

  • Can't set public Object in HTTPService result listener

    Hello.
    I am using a data object class.  The class is based on a class that contains the HTTPService calls.  I want to return the event.results to the local instance of the class by setting a public Object = the results Object. However, the public object is null after the HTTPService event result listener function is finished.
    It is easier to see than to describe:
    In the main application. i make an instace of my activity class:
    myactivity:activity = new activity() ;
    now, I invoke the getdata method:
    myactivity.getdata() ;
    The getdata() method fails at runtime, because it tries to reference the results object.
    See the base class and the activity class below.
    BASECLASS: (just the main parts are listed here):
    public class transferObject
            public var baseurl:String ;
            public var dbresult:Object =new Object();
            public var service:HTTPService ;
            public function transferObject()
            geturl("ghost") ;
            public function geturl(db:String) : void
                    baseurl = "https://xyzzy/" ;
            public function getHttpService(methodname:String):void {
                    service = new HTTPService();
                    service.url = this.baseurl + methodname;
                    service.channelSet ;
                    service.method = "POST";
                    service.addEventListener("result", httpResult );
                    service.addEventListener("fault", httpFault);
                    service.send();
               public function httpResult(event:ResultEvent):void {
                    dbresult = event.result ;
    //DBRESULT IS THE OBJECT I WANT TO REFERENCE IN THE DERIVED CLASS
                 //Do something with the result.
                public function httpFault(event:FaultEvent):void {
                    var faultstring:String = event.fault.faultString;
                    Alert.show('Error sending data: '+faultstring+' '+event.fault);
    HERE IS THE DERIVED CLASS:
    package dataObjects
        public class activity extends transferObject
        import mx.controls.Alert ;   
    [Bindable]
    public var event_id:String ;
    [Bindable]
    public var description:String ;
           public function activity()
                super();
            public function getdata():void
                getHttpService("eventually.sendtest") ;
              this.event_id = dbresult.result.activities.activity.getItemAt(0).event_id ;
    ----> THE LINE ABOVE FAILS AT RUN TIME BECAUSE THE DBRESULT OBJECT IS NULL
    THANK YOU FOR ANYHELP YOU CAN PROVIDE

    Sorry, but parameters of a ServeletRequest can not be modified. Look at the javadocs on ServeletRequest and you will see that "getParameterMap" returns an immutable Map. JSF is simply wrapping that method call with their own "getRequestMap" method. Setting an attribute, request.setAttribute(name, object), is how you pass things using the request to servlets, jsps, etc. on down the line. Just get the attribute instead of the parameter where you need it. Set your "parameter" in the attributes, down the line, check the attribute first, if it exists, use it, otherwise look for the parameter.

  • A problem with accessing the public variable inside the function

    Hi,
    I have got this package and I get error 1120: 1120: Access of undefined property aa
    Could you explain why I get this error?
    package somepackage {
        import flash.display.DisplayObject;
        import mx.containers.Canvas;
        public class SoundPictureSigns extends Canvas {
            public var aa:int = 12;
            public function SoundPictureSigns():void {
            public static function setUpSignSizes():void {
                trace("aa="+aa); /// ERROR here: 1120: Access of undefined property aa
    Can you help?
    Regards

    When you write
    class C
        var v;
    you are defining a variable that lives inside each instance of C. In other words, you can write code like
    var c:C = new C();
    c.v = 1;
    If you don't have an instance, you can't access v.
    When you write
    class C
        static var v;
    you are defining a variable that lives inside the class itself, and you can access it without having an instance.
    Gordon Smith
    Adobe Flex SDK Team

  • Accessing components vars.

    Hi,
    How do I access a var in a differint component? I have two custom components in the same application and need to get the variable (arrayCollection) from one to populate a chart in the other.

    Thanks Benji,
    ListItems Component
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init(), reloadData()" height="95%" width="100%" backgroundAlpha="0">
    <mx:Script>
         <![CDATA[
              import mx.core.Application;
              import mx.collections.ArrayCollection;
              import mx.containers.Box;
              import mx.controls.Alert;
              import mx.events.DragEvent;
              import flash.net.navigateToURL;
              import mx.events.StateChangeEvent;
              import mx.controls.ComboBox;
              import mx.controls.LinkButton;
              import mx.containers.VBox;
              import mx.controls.CheckBox;
              import mx.controls.Text;
              import mx.containers.HBox;
              import mx.collections.XMLListCollection;
              import mx.rpc.events.ResultEvent;
              import mx.managers.CursorManager;
              import flash.text.TextField;
              namespace ink = "http://www.inktomi.com/";
              use namespace ink;
              //     Archive Vars
              [Bindable] private var xmlList:XMLList;
              [Bindable] private var listCollection:XMLListCollection;
              [Bindable] private var listData:XML;
              [Bindable] public var serviceURL:String = "http://boss.yahooapis.com/ysearch/news/v1/";
              [Bindable] public var searchFor:String = "biotechnology%20AND%20biotech";  
              private const PROXY:String = "http://localhost/employeePhoneDesktop/src/php/proxy.php?url=";
              private const APIID:String = "?appid=######
              private const PARAMS:String = "&format=xml&orderby=date";
              private var reload:Timer;
              //     Archive Vars
              private var vBox:VBox;
              private var hBox:HBox;
              private var titleText:LinkButton;
              private var itemInfo:Text;
              private var abstract:Text;
              private var archive:CheckBox;
              private var rateItem:ComboBox;
              private var category:ComboBox;
              private var container:VBox;
              private var clickURL:Text;
              private var canvas:Canvas;
              private var titleFormat:TextFormat;
              //     Archive Vars
              /*[Bindable]
              public var newsDB:ArrayCollection = new ArrayCollection( [
                     { title: null, clickURL: null, info: null, abstract: null, category: null, rateItem: null }
             public var newsDB:ArrayCollection = new ArrayCollection;
              private function init():void {
                   listService.send()
                   CursorManager.setBusyCursor();
              private function getData(e:TimerEvent):void{
                   listService.send()
                   CursorManager.setBusyCursor();
                   removeChild(container);
              private function reloadData():void {
                   reload = new Timer(10000, 10);
                   //reload.start();
                   reload.addEventListener(TimerEvent.TIMER, getData);
                   //trace(reload.delay);
                   //reload.addEventListener(TimerEvent.TIMER_COMPLETE,
              private function resultHandler(e:ResultEvent):void {
                   listData = e.result as XML;
                   // add the imems to an XMLList and XMLListCollection
                   // so that they can be used with the repeater class
                   // and update automatically
                   xmlList = e.result.resultset_news.result as XMLList;
                   listCollection = new XMLListCollection(xmlList);
                   CursorManager.removeBusyCursor();
                   // populate the layout with datd
                   createLayout();
              private function createLayout():void {
                   container = new VBox();
                   var categoryLabels:Array = new Array("Health","Industrial","Emerging Tech","Food & Ag");
                   var rateLabels:Array = new Array("Positive","Neutral","Negative");
                   for(var i:int=0; i<listCollection.length; i++) {
                        //vBox = new VBox();
                        canvas = new Canvas();
                        hBox = new HBox();
                        titleText = new LinkButton();
                        titleFormat = new TextFormat();
                        itemInfo = new Text();
                        abstract = new Text();
                        archive = new CheckBox();
                        rateItem = new ComboBox();
                        category = new ComboBox();
                        clickURL = new Text();
                        titleText.label = listCollection.getItemAt(i).title;
                        //titleText.addEventListener(MouseEvent.DOUBLE_CLICK, getURL);
                        titleText.addEventListener(MouseEvent.CLICK, getURL);
                        titleText.width = 400;
                        clickURL.text = listCollection.getItemAt(i).clickurl;
                        clickURL.visible = false;
                        clickURL.includeInLayout = false;
                        itemInfo.text = listCollection.getItemAt(i).source + " | " + listCollection.getItemAt(i).date;
                        itemInfo.y = 25;
                        abstract.text = listCollection.getItemAt(i).abstract;
                        abstract.y = 42;
                        abstract.visible = true;
                        abstract.includeInLayout = true;
                        abstract.width = 400;
                        abstract.height= 60;;
                        archive.label = "Archive";
                        category.prompt = "Category";
                        category.dataProvider = categoryLabels;
                        category.rowCount = categoryLabels.length;
                        category.visible = false;
                        category.includeInLayout = false;
                        category.width = 95;
                        category.height = 20;
                        rateItem.prompt = "Rate";
                        rateItem.dataProvider = rateLabels;
                        rateItem.visible = false;
                        rateItem.includeInLayout = false;
                        rateItem.width = 95;
                        rateItem.height = 20;
                        canvas.addChild(titleText);
                        canvas.addChild(clickURL);
                        canvas.addChild(itemInfo);
                        canvas.addChild(abstract);
                        canvas.addChild(hBox);
                        hBox.addChild(archive);     
                        hBox.addChild(category);
                        hBox.addChild(rateItem);
                        hBox.y = abstract.y + 60;
                        hBox.percentWidth = 80;
                        hBox.percentHeight = 80;
                        archive.addEventListener(Event.CHANGE, toggleArchive);     
                        container.addChild(canvas);          
                   container.x = 10;
                   container.y = 10;
                   addChild(container);
       // If someone chooses to archive the item, set the properties of the
       // ComboBoxes (visible & includeInLayout) to true
       private function toggleArchive(e:Event):void {
             var chb:CheckBox = e.currentTarget as CheckBox;
             var hBox:HBox = chb.parent as HBox;
             var len:int = hBox.numChildren;
             for(var i:int=0; i<len; i++) {
                   var cb:DisplayObject = hBox.getChildAt(i);
                   if((cb is ComboBox)) {
                    // toogle visibility and include in layout
                    (cb as ComboBox).visible = chb.selected;
                    (cb as ComboBox).includeInLayout = chb.selected;
       // Called when someone clicks on the titleLink. This function pulls the
       // origional website URL up in a seperate browser window
       private function getURL(e:MouseEvent):void {
                 var link:LinkButton = e.currentTarget as LinkButton;
                 var canvas:Canvas = link.parent as Canvas;
                 var clickURL:Text = canvas.getChildAt(1) as Text;
                 var url:URLRequest = new URLRequest(clickURL.text);
                 navigateToURL(url);
              trace(clickURL.text);
      /* private function showAbstract(e:MouseEvent):void {
                    var link:LinkButton = e.currentTarget as LinkButton;
                 var canvas:Canvas = link.parent as Canvas;
                 var abstract:Text = canvas.getChildAt(3) as Text;
                 var hBox:HBox = canvas.getChildAt(4) as HBox;
                 link.removeEventListener(MouseEvent.CLICK, showAbstract);
                 link.addEventListener(MouseEvent.CLICK, hideAbstract);
                 abstract.visible = true;
                 abstract.includeInLayout = true;
                 while(abstract.hitTestObject(hBox) == true){
                      hBox.y += 1;
                 trace(canvas.getChildren());
       private function hideAbstract(e:MouseEvent):void {
                    var link:LinkButton = e.currentTarget as LinkButton;
                 var canvas:Canvas = link.parent as Canvas;
                 var abstract:Text = canvas.getChildAt(3) as Text;
                 var hBox:HBox = canvas.getChildAt(4) as HBox;
                 link.removeEventListener(MouseEvent.CLICK, hideAbstract);
                 link.addEventListener(MouseEvent.CLICK, showAbstract);
                 abstract.visible = false;
                 abstract.includeInLayout = false;
              hBox.y = 35;
                 trace(abstract.text);
       public function archiveData():void {
                 var containerArray:Array = container.getChildren() as Array;
                 for(var i:int=0;i<containerArray.length;i++){
                 //for(var i:int=0;i<1;i++){
                      var canvas:Canvas = container.getChildAt(i) as Canvas;
                      var titleText:LinkButton = canvas.getChildAt(0) as LinkButton;
                      var clickURL:Text = canvas.getChildAt(1) as Text;
                      var itemInfo:Text = canvas.getChildAt(2) as Text;
                      var abstract:Text = canvas.getChildAt(3) as Text;
                      var hBox:HBox = canvas.getChildAt(4) as HBox;
                      var archive:CheckBox = hBox.getChildAt(0) as CheckBox;
                      var category:ComboBox = hBox.getChildAt(1) as ComboBox;
                      var rateItem:ComboBox = hBox.getChildAt(2) as ComboBox;     
                      if(archive.selected == true){
                        newsDB.addItem( {
                        title: titleText.label,
                        clickURL: clickURL.text,
                        info: itemInfo.text,
                        abstract: abstract.text,
                        category: category.selectedLabel,
                        rateItem: rateItem.selectedItem });                    
                      trace(newsDB[0].title);
       private function archiveSuccess():void {
                 Alert.show("Your clips have been successfully saved","Archive Complete");        
       private function archiveFault():void {
                 Alert.show("Your clips have not been saved. Please contact an administrator.","Archive Error");
         ]]>
    </mx:Script>
         <mx:HTTPService id="listService" url="{serviceURL + searchFor + APIID + PARAMS}" result="resultHandler(event)" resultFormat="e4x"/>
    </mx:Canvas>
    Main mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
         layout="absolute"
         xmlns:com="components.*"
         backgroundGradientAlphas="[1.0, 1.0]"
         backgroundGradientColors="[#EDF4FF, #C6D9FF]"
         width="800" height="600"
         backgroundAlpha=".75"
         title="  Media Trap Beta V1.1"
         titleAlignment="left"
         creationComplete="init()">
         <mx:Script>
              <![CDATA[
              ]]>
         </mx:Script>
         <mx:Style source="assets/style.css" />
         <mx:Label x="19" y="14" text="Media Trap" fontWeight="bold" fontSize="20"/>
         <mx:Label x="20" y="38" text="beta 1.1"/>
         <mx:TabNavigator id="navigator" width="450" height="89%"  x="20" y="61">
              <mx:VBox label="News">
                   <com:listItems id="newsFeed" name="newsFeed" backgroundColor="#FFFFFF" x="0" y="0" height="100%">
                   </com:listItems>
              </mx:VBox>
              <mx:VBox label="Blogs">
                   <mx:Text text="Blog Coverage"/>
              </mx:VBox>
              <mx:VBox label="Twitter">
                   <mx:Text text="Twitter Coverage"/>
              </mx:VBox>
              <mx:VBox label="Video">
                   <mx:Text text="Video Coverage"/>
              </mx:VBox>
         </mx:TabNavigator>
         <mx:Button x="348" y="36" label="Archive Selected" click="newsFeed.archiveData()"/>
         <!--<com:currentArchiveChart id="currentCats" x="478" y="81" height="212" />-->
    </mx:WindowedApplication>
    Charting Component
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="300" height="346" xmlns:com="components.*" creationComplete="init()" >
        <mx:Script>
            <![CDATA[
            import mx.core.Application;
            import mx.collections.ArrayCollection;
              // testing variable
            [Bindable]
            private var medalsAC:ArrayCollection = new ArrayCollection( [
                { Country: "USA", Gold: 35, Silver:39, Bronze: 29, Test: 20000 }
            private function init():void{
                 trace(mx.core.Application.application.myListItems.newsDB as ArrayCollection);
                 medalsAC.addItem( { Country: "Canada", Gold: 75, Silver:39, Bronze: 29 });
                 medalsAC.addItem( { Country: "England", Gold: 100, Silver: 200, Bronze: 100 });
            private function displayGold(data:Object, field:String, index:Number, percentValue:Number):String {
                var temp:String= (" " + percentValue).substr(0,6);
                return data.Country + ": " + '\n' + "Total Gold: " + data.Gold + '\n' + temp + "%";
            ]]>
        </mx:Script>
             <mx:Label id="archiveTitle" x="10" y="10" text="Current Archive " fontSize="14" fontWeight="bold"/>
             <mx:PieChart id="chart" height="130" width="300" color="0x323232"
                showDataTips="false" dataProvider="{medalsAC}"  y="22">
                <mx:series>
                    <mx:PieSeries labelPosition="callout" field="Gold">
                    </mx:PieSeries>
                </mx:series>
            </mx:PieChart>
    </mx:Canvas>

  • Flash Vars is not working when we accessing from other class files

    Hi all, I'm currently developing a flex application where i
    need to pass the data from the flash vars to the other class files
    instead of the main actionscript class file.
    Does any body know how i should go about doing that?? you can
    see this below code : please help me out if u know how to solve
    testnew2.as file
    package {
    import flash.display.Sprite;
    import flash.display.LoaderInfo;
    public dynamic class testnew2 extends Sprite {
    public var
    xmlfile:String=String(root.loaderInfo.parameters.lists);
    public function testnew ():void{
    package {
    import flash.text.TextField;
    import flash.display.Sprite;
    import flash.display.LoaderInfo;
    public dynamic class testnew extends testnew2 {
    public function testnew () {
    var myText:TextField = new TextField();
    // this assumes that you are going to pass in an id variable
    // on the end of the myFile.swf?id=12345 or
    // use FlashVars in the HTML parameter list for instance
    // 'FlashVars', 'id=123456', 'width', '1024',
    myText.text = new testnew2().xmlfile;
    addChild(myText);
    but if we access in same file it is working fine:
    package {
    import flash.text.TextField;
    import flash.display.Sprite;
    import flash.display.LoaderInfo;
    public dynamic class testnew extends Sprite {
    public function testnew () {
    var myText:TextField = new TextField();
    myText.text = String(root.loaderInfo.parameters.lists);
    addChild(myText);

    Pass the data into the main app, then from there either pass
    it into the sub-components or use
    Application.application.parameters, or bind to the values.
    Tracy

  • Using a var declared in a function outside that function

    Hey, i am trying to do something i thought wouldn't be difficult, but looks like i'm wrong.
    So this is a function that runs from the start (creationcomplete). Inside i declare a var txt (which is a string)
    public function sendString(Event:FlexEvent):void
    txt = "Voorbeeld van een band";
    I want to call that var outside of the function. So I make it bindable. it's also the reason why i call teh var just by "txt" in the functions above.
    [Bindable]
    public var resultName:String;
    Now, in this label i call the var txt. However, the label stays empty. Though I don't get any errors.
    <s:Label x="20" y="69" fontSize="16" text="{txt}"/>
    Can anyone help me fix this? I figure it should be rather easy, but still.
    Also, If i call the function from a mouseclick, will i get an error then since the label asks for a var that doesn't exist yet?
    Many thanks!

    Local variables can be seen or use databinding.  Try making an instance variable on the class/document

  • Accessing public variables

    I have the code below. What I am trying to do is to print out
    the value of a public variable. I am trying to change that public
    variable in the function that handles the result of the remote
    object call. The problem is the value only seems to change in the
    function and no where else. Any ideas?
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="load_list()">
    <mx:script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.collections.ArrayCollection;
    import mx.rpc.events.ResultEvent;
    [Bindable]
    public var material1_ID: int;
    public function load_list():void{
    material1_ID = 0;
    public function addRec():void{
    Alert.show('value before' + material1_ID.toString());
    insertService.addMaterial('123'); // THis calls my webservice
    and returns a query
    Alert.show('value after' + material1_ID.toString());
    public function addMaterial(event:ResultEvent):void{
    material1_ID = 9;
    ]]>
    </mx:Script>
    <mx:RemoteObject
    id ="insertService"
    destination="ColdFusion"
    source ="insert"
    >
    <mx:method name="addMaterial" result="addMaterial(event)"
    >
    </mx:RemoteObject>
    </mx:Application>

    This function in your code:
    public function addRec():void{
    Alert.show('value before' + material1_ID.toString());
    insertService.addMaterial('123'); // THis calls my webservice
    and returns a query
    Alert.show('value after' + material1_ID.toString());
    Looks to me like you are making the remote call and then
    expecting the next line to access the result. Flex doesn't work
    that way. Remote calls (including HTTPService and WebService) are
    asynchronous. When you make the addMaterial call, the request goes
    out and the response comes back "later". So right after that
    request the value won't be changed.
    If you print the value in the result handler, you'll see that
    it will be changed.

  • Var in loop

    hello all,
    I have a action script class which is bindable and
    instantiates objects of other class
    as :
    quote:
    [Bindable]
    public class Templateobjects
    public var template1 = new sampleTemplate1();
    public var template2 = new sampleTemplate2();
    public function Templateobjects(){
    // constructor function
    and in my mxml file i import this class as and trying to
    access this variables in this class, as:
    import Templateobjects;
    public var templatelistObject:Templateobjects = new
    Templateobjects();
    for(var i:Objects in Templateobjects){
    trace(" found objects");
    i am not getting the trace...
    please tell me how should i go about this.
    Regards
    Mayur

    From the docs:
    ...you can use a for..in loop to iterate through the
    properties of a generic object...What you cannot do is iterate
    through the properties of an object if it is an instance of a
    user-defined class, unless the class is a dynamic class. Even with
    instances of dynamic classes, you will be able to iterate only
    through properties that are added dynamically.

  • Passing VARs between MXML Application and MXML components!

    Hi,
    I'm trying to pass a variable between the MXML Application and the MXML Component with ValueObjects.
    But when i call the variable on the MXML Component it is null!
    ValueObject Class Code:
    package valueObjects
        [Bindable]   
        public class MyGlobalVars
            public var NomeGaleria: String;
            public function MyGlobalVars()
    MXML Application Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"  xmlns:comp="components.*" layout="vertical" height="100%" width="100%" >
    <mx:Script>
        <![CDATA[
            import valueObjects.MyGlobalVars;
            import mx.managers.PopUpManager;
            import mx.core.Container;
            [Bindable]
            public var nomeGaleria:MyGlobalVars;
            private function AbreGaleria():void{
                  nomeGaleria=new MyGlobalVars();
                nomeGaleria.NomeGaleria = "Moda";
                PopUpManager.addPopUp(new galeriaImagens(),this,true);
        ]]>
    </mx:Script>
    <mx:Panel height="673" width="839" verticalAlign="middle" borderStyle="none" layout="absolute">
        <mx:Canvas id="SMGaleria" width="815" height="30" x="2" y="98"">
            <mx:LinkButton x="474" y="5" label="moda" click="AbreGaleria()"/>   
         </mx:Canvas>
        <mx:ViewStack id="content" height="440" width="815" borderStyle="none" x="2" y="128">
            <comp:galeriaImagens id="GaleriaImagens" x="0" y="5" strGaleria="{nomeGaleria}"/>
        </mx:ViewStack>
    </mx:Panel>
    </mx:Application>
    MXML Component Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:TitleWindow  xmlns:mx="http://www.adobe.com/2006/mxml"
        showCloseButton="true" creationComplete="CenterMe()" backgroundColor="#000000" xmlns:components="components.*" >
    <mx:Script>
        <![CDATA[
            import valueObjects.MyGlobalVars;
            import mx.controls.Alert;
            [Bindable]
            public var strGaleria:String;
            private function CenterMe(): void{
                 Alert.show(strGaleria);
        ]]>
    </mx:Script>
    </mx:TitleWindow>
    On the MXML component the value of strGaleria is null! It would not have to be: Moda??

    You may need to change your code as follows:
    <comp:galeriaImagens id="GaleriaImagens" x="0" y="5" strGaleria="{nomeGaleria.NomeGaleria}"/>
    Previously you had set strGaleria to the value of the object, not the string within the object.
    But I think you will still have a problem because function AbreGaleria will not be called until the user clicks the link button, and only then will NomeGaleria have a value, so I would set a default value as follows, otherwise at app launch it will be null:
    public var NomeGaleria: String = "";
    or  if that does not work
    public var NomeGaleria: String = " ";
    Another possible problem is that you are calling this code at the component creationComplete, but the LinkButton has not been clicked yet, so the value object string value has not been set, so the alert will not display anything:
    private function CenterMe():void{
        Alert.show(strGaleria);
    I think you need to reorganize some things here.
    If this post answers your question or helps, please mark it as such.

Maybe you are looking for

  • SQL Function in SQLJ

    I am still getting following error: java.sql.SQLException: Invalid column name below is my sample code when I run it without decoding it runs fine but when I do decoding it gives me above error void dpi(int batch_no) throws SQLException { BatchRec dp

  • S video with Flash Encoder 3.2

    We stream a great number of events for clients around the country.  We have just transitioned from Windows Media Encoder to Flash Encoder 3.2.  Is there any work around for those clients of ours that use S video out of their cameras.   Flash Encoder

  • Business Packages on CE 7.3

    Hi All, Just wondering if CE 7.3 lets Business Packages deployed on it, I am aware that CE 7.1 does not support this option.  Thanks, Vamshi

  • Is Quicktime Upgrade required to download music from itunes?

    I recently upgraded to the nweer version to itunes. Then a couple of weeks later a receive a messsge telling me that an upgrade for quicktime is available. I choose to ignore this pop up. The next time I go to itunes to download music I get an error

  • ACE - VIP address on different subnet

    Hello, Is it possible to configure a VIP address that is different from the VLAN subnet where it is applied on? Fe: VIP is 10.10.10.1/24 on VLAN 10 Interface of ACE in VLAN 10 is 192.168.1.1/24 On the upstream routers, a static route points to the VI