Instantiation of class through mxml - definition of the properties

Hello

I am trying to create a reusable component with an actionscript class.

I would like to be able to put a handful of attributes of the class properties withmxml. So far I have had no success doing so.

I have my problem subset in a separate simplified project, in an attempt to exclude any of the other parts of the actual application interfere with what I seek to accomplish. Unfortunately, my simplified project gives the same result.

In my example, I'm just trying to set the value of the property "myValue"  Can someone tell me what I am doing wrong? What Miss me?

Thanks in advance for any help!

Main application (TestProj.mxml)

<?xml version="1.0" encoding="utf-8"?>
<s: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:pkg="pkg.*">
     <fx:Declarations>
          <!-- Place non-visual elements (e.g., services, value objects) here -->
     </fx:Declarations>
     
     <pkg:TestClass myvalue="some value" />
     
</s:Application>

ActionScript (pkg\TestClass.as) class

package pkg
{
     import mx.controls.Alert;
     import mx.core.UIComponent;

     public class TestClass extends UIComponent
     {
          
          private var _myvalue:String;
          
          public function TestClass()
          {
               Alert.show("myvalue=" + this._myvalue);     
          }

          public function get myvalue():String
          {
               return _myvalue;
          }

          public function set myvalue(value:String):void
          {
               _myvalue = value;
          }

     }
}

Hello

The property is set correctly, but your class constructor always executes before the attributes - it is because Flex needs to create the instance and run the c - tor before it can set values on the instance.  Instead, try something like this:


This will run the Alert.show when the component is initialized.  If you need to put an init code in the component itself and that the code is based on the values defined in MXML, then you can override the UIComponent public function initialize (): void.

-Evtim

Tags: Flex

Similar Questions

  • Definition of the properties of Description

    Hello

    I am newto dreamweaver and use version 8. I would firstly the Description parameter properties and looked on the show help page to do this and found the following: see my message below. However, I can't find the Description text box. Any help is to put the description would be much appreciated.

    Thank you very much
    Martin

    Definition of the properties of Description
    Search engine robots (programs that automatically browse the web for gathering information for search engines to index) read the contents of the meta Description tag. Some use the information to index your pages in their databases, and some also display the information on the page of search results (instead of display the first lines of your document). Some search engines limit the number of characters they index, so it's a good idea to limit your description to a few words (for example, barbecue pork catering in Albany (Georgia), or web design at reasonable rates for customers around the world).

    Enter descriptive text in the Description text box.

    A big thank you John, it's exactly what I was looking for.

  • Definition of the properties of dynamic variables

    I asked this down in the forum of Actionscript 3.0, but it was maybe in the wrong place... I really need some help here to finish an application we create.

    Thank you!

    If I create the textareas dynamically how I loop through them eventually to set their properties?

    So basically, I have a few textareas with the ID of
    myText_0
    Montexte_1
    Montexte_2
    myText_3
    (etc.)

    and I have a loop of
    for (var x: int = 0; x < 4; x ++)
    {
    Insert here the AS3 code
    }

    inside the loop, I need to be able to say something like:
    myText_x.height = 50;
    myText_x.text = "Hello" + x.toString ();

    Thanks ntsiii rating of support did not work the way you say it, but if it is written as:

    This ["myText_" + x] .height = 50;
    This ["myText_" plus x] .text is "Hello" + x.toString ();

    And to think three days ago, I put him had competently parens instead of brackets (argh).

  • Definition of the properties of virtual machines in a paralytic

    I have a few vApps with 25 virtual machines from each in vCloud Director and would like to start a few properties to market / stop with PowerCLI as mistletoe is a mission. These options include:

    The value 'Enable customization of comments' Yes, 'change SID"no and"Reset Password"No..

    I looked at the available with "get-command - Module vmware.vimautomation.cloud" command-lets, but I don't see anything which allows the manipulation of the VMs system in a paralytic.

    I'd be able to make these changes with PowerCLI?

    Thank you!

    We gave no date as to where the cmdlets for manipulating the objects will be available, but as mentioned in this thread of Luke, you can use the Get-CIView or. ExtensionData to manipulate the API.

    Unfortunately I don't have the infrastructure to test this right now but you could try something like this:

    $CIvApp = Get-CIVApp Domain01
    Foreach ($CIVM in ($CIvApp | Get-CIVM)) {
        $GuestCustomization = $CIVM.ExtensionData.Section | Where {$_.GetType() -like "*GuestCustomizationSection"}
        $GuestCustomization.Enabled = $true
        $GuestCustomization.ChangeSid = $true
        $GuestCustomization.ResetPasswordRequired = $false
        $GuestCustomization.UpdateServerData()
    }
    

    Domain01 is the name of my TIME

  • Definition of the properties on the managed Bean user interface component:

    Hello

    I use jdev 11.1.1.1.0 version.
    In Managed bean, I get the component by using the id given in page .jspx.
    the code I am uisng is:

    FacesContext fc = FacesContext.getCurrentInstance ();
    UIComponent uc = (UIComponent) fc.getViewRoot () .findComponent ("it32");


    Here, the component is sometimes RichColumn and sometimes RichInputtext.
    In the case of RichInputText, I need to set the readonly property to true/false depending on some condition .i found no setReadOnly() ant on the UI component.

    so I think to convert the UIcomponent type RichInputText or RichColumntype. (if I convert the means I get methods like setReadOnly(), setVisible())
    How is it possible.

    (or is anyway to set the "readonly", 'visible' properties on UIcomponent itself in the Managedbean without conversion).


    PLs help me
    Sanchez.

    Hello

    You can get the instance of the component or use UIComponent.getAttributes () .put (attributeName, attributeValue); For example:

    theComponent.getAttributes().put("readOnly", Boolean.TRUE);
    

    Kind regards

    ~ Simon

  • Restoration of the accessors of class through properties

    LV2013

    When you create an accessor for a class data member, you have the possibility to make this available through nodes in property accessor class.

    I accidentally deleted a VI of the accessor.

    The VI himself is still; It's pretty easy to ADD the file in the project.

    But when I do, the properties that you to reconnect.  I can replace it with the VI and everything is fine, but there are cases where two or more values I want and I want to use a property node to get.

    How can I say this VI it should be accessible through knots of property?

    You must add a "property definition" file (as you create a subfolder in a library/project) in your class.

  • definition of the base class _ not found

    Hello!

    While exploring Flex 3 (really good btw) and build my first app, I tried the following:

    SerializableAttribute public class X extends EventDispatcher {}

    It gives me a compilation error #1017: the definition of the EventDispatcher base class was not found.

    To compile I am just use a file .bat, such as those used in the samples. Everything compiles normally without extending an existing class (in this case flash.events.EventDispatcher).
    Try to change the compiler options with
    -library-path += c:\flex\framework\libs
    has resulted in the same error here (and I guess that's already a default setting).

    Any help would be greatly appreciated!

    Fre

    It worked :-). Thank you very much, Deepa!

    So, apparently, you can make import declarations in the declaration of class (or anywhere in the code), but always before you use the imported class. I got confused, as in java, all import instructions are in the same place and import flash.net worked under my class declaration.

  • Classification error. The class begins is greater at the end of the class.

    Hello

    I am looking for a solution to an error that doesn't make much sense to me:

    Error in (online: 75, column: 3):

    Classification error. The class begins is greater at the end of the class.

    It seems that when I call the VBS attached on the PDM also attached. Tiara 2012. The index file does not make through the system of download here.

    It seems to be triggered by funtion ChnHistogram() and the help page says something about ClassBegin/end being "global settings". What do these? Where we fixed them.

    Thanks in advance for clues.

    Hey cubz,.

    script is great for debug it quickly.

    The problem is caused by the ChnHistogram 75 online. It happens in the 3rd iteration of the loop to the detour.

    The issue seems to be the ClassBegin or ClassEnd parameter. I think the error message should tell you that ClassBegin > ClassEnd, but this needs debugging later.

    Best regards, Stephan

  • Error 123: Timeout to libFrame_OpenPageRef.vi while trying to open the properties of the class

    I get an error message 123: time-out when you try to open the class properties dialog in a project.

    Here is the image:

    Anyone have any suggestions on how to fix this? I need to be able to change the class inheritance and other properties. When you open the properties in a new (empty) project, the dialog box opens very well (as slow as usual, that is). The project contained in this class is very large: something like 1200 live and classes 50 +.

    dthor,

    Another possible workaround solution, which I think you discussed previously, is to add the class to a new project file and change the properties of the class through this project. I change the properties in a new project will change the properties of your project to VI of 1200. However, you will not be able to change properties in the new draft, while the old project is still open.

    Sorry for the inconvience, R & D is trying to solve this problem.

  • Definition of the word "Rootkit".

    (Sorry if this is the wrong subject, but at least it includes the definition of the word ;-)
    There are two competing definitions of the word; Rootkit

    The first is:
    -ROOTKIT = 1: "hide", 2nd: 'malicious', performs actions harmful to the network, system or users. He must do the 1st and the 2nd is assumed.
    (In this definition of the first part, root means something that lies under the surface.)
    The second is:
    -ROOTKIT = software that includes privileged code, using the resources of protected system and functions. The term dates with Unix System Utilities that provided functions not in the operating system. The current use is for the privileged of the legitimate software and malware who wins and who uses privileges through unauthorized means.
    (In this definition of the first part, root means the privileged or administrative account on a Unix system).

    People who work with or for one of the organizations AV utility, use the second. They generally speak of a detection of rootkits to change system made by a valid software as a legitimate Rootkit and a false positive detection. So they specifically differentiate legitimate Rootkits and malicious Rootkits. All the utilities Virus definitions include a legitimate list of these Rootkits to eliminate false positive detections.

    It would seem that the demarcation line may be IS professional and 'lay '. But the document Microsoft, Understanding Anti-Malware Technologies, seems to be using the first definition. If address to business people, but the wait is it was written by a professional.

    Is there a principal security analyst at Microsoft, who might have real experience at the origin of this word. (No kiddies offense, but are looking for some who actually fought in the 'little Indian-Big Indian war').

    (Note: Rootkit is always indicated as badly spelled, if developers of Office have not yet added to their 'words' dictionary)

    So you don't think it might help to post if you are looking for people with experience Unix in Unix forums instead of Microsoft forums?

    The thread may be in another part of the whole of the site answers Forums, but you are always in the wrong place.

    To use an analogy, you go to the forum of plumber to request information on how the Electrical Code are 120 and 240 circuits in homes rather than ask the electrician forum.  Maybe some electical plumber also works and may know, but are not significantly higher chances of success asking a group of electricians instead?

  • Manipulate the properties of component definition

    Currently I have containers that are separate pages in main.qml

    pages: main.qml, CustomContainer.qml

    Page {
      CustomContainer{
         id: myCustomContainer
      }
    
    }
    

    I want to use this

    Page {
      attachedObjects: [
        componentDefinition: {
           id: myCustomContainer
           source: "CustomContainer.qml"
        }
      ]
    
    }
    

    I want to make the definitions of component so I can destroy them when not used however

    I don't know how to access the properties of CustomContainer subsequently

    Here are some examples of how I do now

    Page {
      CustomContainer{
         id: myCustomContainer
      }
    
      onSomePropertyAliasChanged: {
    
      }
    }
    

    or

    myCustomContainer.somePropertyAlias = somethingNew
    

    Although more sense, you should be able to access the standard way, if for example alias property in the component of property you want to edit and navigate through the object you created...

                            myPage.source = "Custom.qml";
                            var page = myPage.createObject();
                            page.myProperty = "test";
    
    // Custom.qml
    
    Page {
        property alias myProperty: lab.text
    
        Label {
            id: lab
            text: "Replace me"
        }
    }
    
  • "Initial Moveto in the definition of the missing path" is displayed on the console

    Hello-

    I have an AreaChart using by default, all styles... nothing is done on my side with respect to css styles.

    I see this message on the console

    "Initial Moveto missing in the definition of the path. "[Path: Path@fe315d[styleClass=chart-series-area-fill series0 by missing color0]."

    -What it means and how to fix it?

    Here is the code that you can run to see the message on the output...


    import java.util.concurrent.ConcurrentLinkedQueue;
    import java.util.concurrent.ExecutorService;
    import java.util.concurrent.Executors;
    import java.util.logging.Level;
    to import java.util.logging.Logger;
    Import javafx.animation.AnimationTimer;
    Import javafx.animation.Timeline;
    Import javafx.application.Application;
    Import javafx.scene.Scene;
    Import javafx.scene.chart.AreaChart;
    Import javafx.scene.chart.NumberAxis;
    Import javafx.scene.chart.XYChart.Data;
    Import javafx.scene.chart.XYChart.Series;
    Import javafx.stage.Stage;

    /**
    * A table that fills the space between the line of data points and axes.
    * Good to compare the totals accumulated over time.
    *
    * @see javafx.scene.chart.Chart
    * @see javafx.scene.chart.Axis
    * @see javafx.scene.chart.NumberAxis
    * @related graphics/line/LineChart
    * @related graphics/clouds of points/ScatterChart
    */
    SerializableAttribute public class AreaChartSample extends Application {}
    private static final int MAX_DATA_POINTS = 50;

    series privacy;
    private int xSeriesData = 0;
    private ConcurrentLinkedQueue < number > dataQ = new ConcurrentLinkedQueue < number > ();
    ExecutorService executor private;
    Private AddToQueue addToQueue;
    timeline2 private chronology;
    private NumberAxis xAxis;

    {} private void init (primaryStage stage)
    xAxis = new NumberAxis(0,MAX_DATA_POINTS,MAX_DATA_POINTS/10);
    xAxis.setForceZeroInRange (false);
    xAxis.setAutoRanging (false);

    NumberAxis yAxis = new NumberAxis();
    yAxis.setAutoRanging (true);

    -Table
    final AreaChart < number >, sc = new AreaChart <, number >(xAxis, yAxis) {}
    Replace to remove the symbols on each data point
    @Override protected void dataItemAdded (int itemIndex, < number >, series, data element < number >,) {}
    };
    sc.setAnimated (false);
    sc.setId ("liveAreaChart");
    sc.setTitle ("graphic animation in areas");

    -Series of cards
    series = new AreaChart.Series < number >, ();
    series.setName ("graphic box series");
    sc.getData () .add (series);

    primaryStage.setScene (new Scene (sc));
    }

    @Override public void start (point primaryStage) throws Exception {}
    init (primaryStage);
    primaryStage.show ();

    -Services of executor to prepare
    the executor = Executors.newCachedThreadPool ();
    addToQueue = new AddToQueue();
    Executor.Execute (addToQueue);
    -Prepare the timeline
    prepareTimeline();
    }

    Public Shared Sub main (String [] args) {}
    Launch (args);
    }

    private class AddToQueue implements Runnable {}
    public void run() {}
    try {}
    Add a piece of random data to the queue
    dataQ.add (Math.random ());
    Thread.Sleep (50);
    Executor.Execute (this);
    } catch (InterruptedException ex) {}
    Logger.getLogger (AreaChartSample.class.getName ()) .log (Level.SEVERE, null, ex);
    }
    }
    }

    -Timeline is called in the main thread of JavaFX
    private void prepareTimeline() {}
    All images take all data in queue and add it to the chart
    new AnimationTimer() {}
    @Override public void handle (long) {}
    addDataToSeries();
    }
    }. start();
    }

    private void addDataToSeries() {}
    for (int i = 0; I < 20; i ++) {/ /-add 20 numbers to plot +}
    If (dataQ.isEmpty ()) break;
    series.getData () .add (new AreaChart.Data (xSeriesData ++, dataQ.remove ()));
    }
    Remove points to keep us not more than MAX_DATA_POINTS
    If (series.getData () () .size > MAX_DATA_POINTS) {}
    series.getData () .remove (0, series.getData () .size () - MAX_DATA_POINTS);
    }
    Update
    xAxis.setLowerBound(xSeriesData-MAX_DATA_POINTS);
    xAxis.setUpperBound(xSeriesData-1);
    }
    }

    I just test this code and let it run for one minute. I've not seen this kind of message - I use JavaFX 2.2 b 13 - it may have already been fixed.

  • Safeguarding of documents through scripting: name of the active file Get and set save path/file type

    I am writing a script that will:

    -Do all the invisible layers

    -Make the layer visible ' background'

    -Remove all the invisible layers

    -Save the document as EPS file (leaving the original intact)

    I am new to scripting and I based my script by copying the code of other scripts.

    Here is my code:

    var doc = app.activeDocument;

    var name = doc.name;

    hide var = function () {/ / hide all layers (based on http://forums.adobe.com/thread/644267( )}

    var L = doc.layers.length;

    for (j = 0; j < L; j ++) {doc.layers [j] .visible = false ;}

    }

    masquer();

    loop through all layers

    for (var i = 0; i < doc.layers.length; i ++) {}

    Create the illusrtratorSaveOptions object to set options to HAVE

    var saveOpts = new IllustratorSaveOptions();

    Definition of the IllustratorSaveOptions properties.

    saveOpts.embedLinkedFiles = true;

    saveOpts.fontSubsetThreshold = 0.0

    saveOpts.pdfCompatible = true

    Implemented Variable for the name of the access layer

    var currentLayer = app.activeDocument.layers [i];

    Loop through the layers and make the background layer visible

    If (currentLayer.name == 'Background') {}

    docName = name + currentLayer.name + ".eps";

    currentLayer.visible = true;

    }

    }

    / / Remove the invisible layers (based on http://www.cartotalk.com/index.php?showtopic=7491( )

    var myDoc = app.activeDocument;

    var layerCount = myDoc.layers.length;

    for (var ii = layerCount - 1; ii > = 0; ii-) {}

    var currentLayer = myDoc.layers [ii];

    currentLayer.locked = false;

    var subCount = currentLayer.layers.length;

    for (var subCount - 1; ss = ss > = 0; ss-) {}

    Underlayment var = currentLayer.layers [ss];

    subLayer.locked = false;

    If (subLayer.visible == false) {}

    subLayer.visible = true;

    subLayer.remove ();

    }

    }

    If (currentLayer.visible == false) {}

    currentLayer.visible = true;

    currentLayer.remove ();

    }

    }

    Save the document with a new name

    var saveName = new queue (doc.path + "/" + Nomdoc);

    doc.saveAs (saveName, saveOpts);

    Everything works well except:

    (1) it saves the document under the name of AdobeIllustratorBackground rather than the name of the document

    In addition, I don't know how to tell the script to save in EPS and specify the save location.

    Could someone give me some advice?          Thank you!

    There is an example script in Adobe Illustrator Scripting/CSx/Sample Scripts/JavaScript/miscellaneous/Save as PDF that has all the parts except the EPS Options.

    Go here for the script Guides and references.

    http://www.Adobe.com/devnet/Illustrator/scripting.html

  • Add Classes of objects before creating the user?

    Hello

    I have a requirement where in I need to add classes of objects to the user during the commissioning of Sun Directory Server. Exactly how should I implement my task of process for the same thing. I might add the object after the task of creating class is complete or until the user creating the task fires?

    Thank you
    PETREA

    Are you talking about adding classes of object customized for users? It would be a schema change and must be done before adding users since that would fail without the correct schema in place. To add new classes of objects you need to either manually create the admin Department page or import the definitions of objects and attributes of an ldif file. Once it is, you can then configure the workflow commissioning and add classes of objects when the user was created so that the system knows what classes of objects associated with each entry of the user.

  • Definition of the attributes of cells of labels

    Hi all

    I would like to define the layout of the cells in the table of labels. For a point page this is possible by setting the attributes of the cell of the label (e.g. "class ="xy"").
    But how this can be done for all labels? In the definition of the label model there is no 'access' to the surrounding table cell.
    At the end there should be something like this:
    ...
    < class td = "yx" >
    < label >... < / label >
    < table >
    where the class attribute of the td element is defined at some point all the elements.


    Any ideas?

    Thanks in advance.

    RG
    Lukas

    The first option is not not to use a class at all: there are other CSS selectors. For example, all the generated APEX motor form layout tables are assigned to a class of *formlayout*. Page 7 of the sample Application, all labels are just aligned by giving their table cells containing an align = "right" attribute. So we can style these cells using a combo of descendant/attribute selector (assuming that IE7 is in standard mode for these):

    .formlayout td[align="right"] {
      padding: 0 0.5em;
      background-color: #ccc;
    }
    

    However, if it is necessary to apply a class , creating a dynamic Action is a way to do this.

    Implementation:
    Advanced

    Identification:
    Name: Add yx class
    Sequence: 10
    Action: Run the JavaScript Code

    When:
    Event: Page load

    Real actions:
    Action: Run the JavaScript Code
    Code:

    $('label').parent('td').addClass('yx');
    

    This dynamic Action uses jQuery to apply a class of *yx* for all the table cells which are the parent of a label element when the page is loaded.

Maybe you are looking for