Dynamically create/edit a .as file

Hello.

I was wondering if it is possible to use the information in an XML file to dynamically set properties and methods on a .as file. Let's say I have a MyClass.as:

class MyClass {}
Properties and methods for MyClass
}

Then I have a MyXML.xml:

<? XML version = "1.0" encoding = "ISO-8859-1? >

Properties of <>
< public >
< public_1 > public_property_1 < / public_1 >
< public_2 > public_property_2 < / public_2 >
...
< public_n > public_property_n < / public_n >
< / public >
< private >
< private_1 > private_property_1 < / private_1 >
< private_2 > private_property_2 < / private_2 >
...
< private_n > private_property_n < / private_n >
< / private >
< / properties >

I want MyClass to define its public and private property, using the data on MyXML.xml, is this possible? If so, can you at least give me some advice as to what is happening? Thank you.

Don't think that you can dynamically generate a class where you instantiate objects. You can create dynamic classes that the class must be made to publish time and you can change the properties of the objects made of him at run - time is the perfect example of a MovieClip.

Tags: Adobe Animate

Similar Questions

  • Infrequent need to create/edit a PDF file

    Is there a product or service available from Adobe that would allow me to create/edit PDF files only once or twice a year without having to pay a monthly subscription?  - Or can I just pay subscription a month every time I need service?

    Hi pjcler,

    I'm sorry there is no option, you can go for monthly, annual subscription or has a perpetual license. Consult prices and Plans of | Adobe Acrobat DC.

    You can try the trial version, but it works as 30 days from the date install you Download Adobe Acrobat free trial | Acrobat Pro DC.

    Kind regards

    Nicos

  • Dynamically creating DataGrid imported .txt file

    I have a tab delimited .txt file exported from Excel which looks like this:

    Sector Section the family Brand Image Description price quantity Code

    Sector 1 Section 1 Description of the Fiat 10000 1 10000 10000 8 25.00 family

    Sector 1 Section 1 1 10001 Kawasaky 10001 Description 10001 10 45.00 family

    Sector 1 Section 1 10002 1 Ford 10002 Description 10002 15 10,00 family

    Sector 1 Section 1 2 10003 Fiat 10003 Description 10003 100 8.00 family

    In this case, I have nine columns, but the method should work with any number of columns.

    The code is developed in Flash Builder, but it's especially AS3.

    I dynamically create a DataGrid from these values. It's my first attempt:

    <? XML version = "1.0" encoding = "utf-8"? >

    " < = xmlns:fx s:Application ' http://ns.Adobe.com/MXML/2009 "

    xmlns:s = "library://ns.adobe.com/flex/spark".

    xmlns:MX = "library://ns.adobe.com/flex/mx".

    creationComplete = "creationCompleteHandler (event)" >

    < fx:Script >

    <! [CDATA]

    import flash.net.URLLoader;

    import flash.net.URLRequest;

    Import mx.collections.ArrayCollection;

    Import mx.controls.DataGrid;

    Import mx.controls.dataGridClasses.DataGridColumn;

    Import mx.events.FlexEvent;

    private var loader: URLLoader = new URLLoader();

    private var request: URLRequest = new URLRequest("txtData/products.txt");

    protected function creationCompleteHandler(event:FlexEvent):void {}

    loader.addEventListener (Event.COMPLETE, loader_complete);

    Loader.Load (request);

    }

    protected function loader_complete(evt:Event):void {}

    Create array of lines in .txt file loaded

    var lines: Array = evt.target.data.split(/\n/);

    var dg:DataGrid = new DataGrid();

    var columns: Array = [];

    var dataProvider:ArrayCollection = new ArrayCollection();

    for (var i: Number = 0; i < lines.length; i ++) {}

    String: var line = lines [i];

    Create array of column values of each row

    var lineArray:Array = line.split(/\t/);

    for (var j: Number = 0; j < lineArray.length; j ++) {}

    var prop: String = lineArray [j];

    {if(i==0)}

    If the first row of the table, create column and assign the value of prop to dataField

    var c:DataGridColumn = new DataGridColumn (prop);

    c.dataField = prop;

    Columns.push (c);

    }

    else {}

    create the new object and add it to the dataProvider

    var dataObject:Object = {area: lineArray [0], Section: lineArray [1], family: lineArray [2], Code: lineArray [3], mark: lineArray [4], Image: lineArray [5], Description: lineArray [6], quantity: lineArray [7], price: lineArray [8]};

    dataProvider.addItem (dataObject);

    }

    }

    }

    assign columns to the dataGrid control

    CGI Columns = columns;

    assign the dataProvider of the dataGrid

    dg.dataProvider = dataProvider;

    Add the DataGrid on stage

    this.addElement (dg);

    }

    []] >

    < / fx:Script >

    < / s:Application >

    I was able to create columns and dataFields dynamically, instead, I wasn't able to do it for the data provider items (see below):

    var dataObject:Object = {area: lineArray [0], Section: lineArray [1], family: lineArray [2], Code: lineArray [3], mark: lineArray [4], Image: lineArray [5], Description: lineArray [6], quantity: lineArray [7], price: lineArray [8]};

    How can I create these values dynamically (without knowing the names number and column data area)?

    Thanks in advance

    use:

    If (i == 0) {}

    for (var j: int = 0; j

    var prop: String = lineArray [j];

    var c:DataGridColumn = new DataGridColumn (prop);

    c.dataField = prop;

    Columns.push (c);

    }

    } else {}

    var dataObject:Object = {};

    for (j = 0; j<>

    dataObject [columns [j] .dataField] = lineArray [j];

    }

    dataProvider.addItem (dataObject);

    }

  • How the script create\edit\save\load file?

    I can't find a tool or a command to create the script file in the powercli environment.

    How to create or load the script file?

    It is the simplest form simply the PowerCLI prompt and a text editor such as notepad for example.

    Once you have your script in a .ps1 file, you can call/run the script from the prompt PowerCLI.

    PS C:\Scripts >./myscript.ps1

    You will have to ensure that the performance of PowerShell policy is set correctly to be able to run scripts.

    The is easier to develop and run scripts using a graphical interface that allows you to edit and run the script in the same graphical interface.

    With PowerShell comes the ISE, which became pretty good in PS v3.

    And there are other GUIs as more than Idera PowerShell and PowerGui.

    One to use is a matter of personal preference

  • How to create dynamic Services based on VMware files

    Hello

    We would like to create as many services as VMware folders in VMware, so whenever we will be add/remove any computer file VMware virtual of the service components will also be day/follow-up...

    We check the option "Create a rule to include a group of components" in the function Builder, and adding the conditions of rule as:

    ! VFolder where name like ''.

    But the result is not successful, because we are unable to choose the right component that inherites the VFolder type components...

    The same works of query in the "Script Console" and the children of the property spreads with all virtual machines...

    Any ideas?

    Thank you.

    Hi Eneko

    One of our systems Consultants found a carton of community that creates dynamic records VMWare-based services. I have attached the cartridge and I included some comments from the author, Thomas Bryant.

    I am pleased to announce the release of version 1.0 of a cartridge personalized for VMware files.  I had a lot of customers ask me to automatically build services in vFoglight based on the structure of folders in vCenter, and that is exactly what will make this cartridge!  This cartridge contains a rule that runs once per hour and will create a category called files VMware services and then for each vCenter, the data center and the series of records, create services and add virtual machines to each, as in vCenter.  Simply load the cartridge and wait about 30 to 60 seconds depending on the number of files you have, and then services will be created.  Please let me know if things work, good or bad.

     

    Updated - Version 1.0.1 released

    The update fixes a problem with the sort order of the structure "Virtual Machines and templates" vs "Hosts and Clusters" and the following files which were not created properly.

     

    Known issues - currently will not remove a service based on a folder that has been deleted from vCenter.  I'll look to add this in the next version.

    One last thing. After you install the cartridge, a new rule, named Custom - create/update records VMware will be added under VMware_Folders cartridge. If edit you it and look at the Conditions & Actions tab, you should be able to see the groovy script that is used to create and populate the services. Here, you should be able to edit the prefix added to each folder in Foglight. By default, the prefix is "Folder_.

    I hope that this solution is satisfactory for you,

    Kind regards

    Gaston.

  • Can you open/edit indesign CS3 files that have been created with CS5?

    I recently purchased indesign CS5 and use that for my internship. However, my boss is still using CS3 and said that she could not open or edit the indesign file that I sent him.  I looked to see if there was an option in 'export' and have not found anything.  I use a mac and I think she uses a P.C., too, when I finally sent him the file, I was still with my free trial - all this make a difference?  Help, please!

    What has been covered time without end, but anyway, I'll do it again!

    You must export a CS5 idml file, and then open the idml in CS4, export a file inx there then that open in CS3 and save it as an indd.  Sorry but there is no way round, presence, end of history etc etc.  If she's using CS3 and you use CS5 there are no roads between them unless you have CS4, and even in this case the road is littered with pitfalls!  Look at here for a pretty long discussion / sometimes write on the subject.

    Ultimately it will have to be upgraded, or you could see if you could buy a CS3 or version 4 but it is very difficult to get a legitimate copy, the only way is to buy it off someone you know and most of the people do not sell because they upgrade.

    Best new last, there is a solution in the short term to this guys blog and you can download a trial version of CS4 that will last for a month.

  • cannot addon, can't edit the necessary files; XP and no only installed script

    Have windows XP sp3 and latest firefox, did install no script but cannot install any other addon. Error - Cannot install, not able to edit the necessary files. This allows Java, allowing other addons does not help.
    Unable to create a new profile that the procedures given do not work.
    Allowing all global scripts does not help.

    Thanks for help

    Michal

    Create a new profile as a test to see if your profile is the source of the problems.

    See "create a profile":

    If the new profile works then you can transfer files from a profile in the new profile, but be careful not to copy files corrupted to avoid transporting on the problem.

  • When dynamically created variables are emptied in the sequential process template?

    I have a sequence TestStand 2014 in which I dynamically create and fill many FileGlobal variables in the installation section of my main sequence.  I have it using the TestStand API to read the data in an Excel file (the data consists mainly of thresholds, limits, etc.).  The methodology itself works flawlessy.

    However, there are differences in behavior when using entry points both execution of the sequential process model.  When you use the entry point of execution 'Single Pass', he has no problem in test a DUT after another.  However, when you use the entry point for execution "Test DUT", I encounter the following error after completing of DUT1 and DUT2 testing:

    An error occurred the call 'InsertSubProperty' in 'PropertyObject' of 'NI TestStand 2014 API.

    The name of the element "VariableName" is not valid because it is already in use.

    I interpret this error message means that the variable I am trying to dynamically create the DUT2 track is already present race of DUT1.  I have a few questions about this:

    1. at what point in the sequential process template are dynamically created variables flushed, such as run a further by using 'Single Pass' starts with a clean slate?

    2. is there a reminder that I can substitute such as variables to rinse after each HAD run, allowing me to dynamically create variables on each HAD, during execution using "Test UUT?

    3. better yet, is there a counter of TestStand I can query to determine if I already ran DUT1 when using "Test DUT", such as DUT2 uses the variables that were created dynamically on trail of DUT1?

    Or you can simply use the PropertyExists function as a precondition.

    PropertyExists ("Locals.Foo")

  • dynamically create and destroy the custom menu item

    I have a standard TestStand platform that I use on multiple systems.  On some systems, I have a few sequences of calibration and I would like to have the Update menu to have the RunSequence of these sequences of calibration.  I know how to manually create these menu items, but they are no longer valid for some sequence files.  I would use the sequence SequenceFileLoad to dynamically create menu items and the SequenceFileUnload to destroy these menu items.

    I've played around with the API, but cannot determine the correct path to get to the create and destroy the custom menu items.  Does anyone know how this can be done?

    Thank you

    Matthew

    Yes, see the online help for the members of the following APIs:

    Engine.GetEditTimeToolMenuItems

    EditTimeMenuItems

    EditTimeMenuItem

    Basically, you get a collection of tool using Engine.GetEditTimeToolMenuItems () menu items and then call EditTimeMenuItems.Insert () or EditTimeMenuItems.Remove (). If you insert a you get returns an EditTimeMenuItem object on which you can change the settings.

    In addition, since it has an expression to hide items in menu tool, you need not necessarily to destroy, you can hide them instead.

    Hope this helps,

    -Doug

  • dynamically called vi, PDM invalid file reference

    Hello

    I can't explain a strange behavior, I hope someone can give me a hint.

    First of all, do not ask why I need this way to go, I would like to understand why this is happening.

    We have a FGV which has 3 actions: Init, write data and close. It works on the TDMS files. The action of the init creates a TDMS file reference that is stored in a shift register to be prepared, used by writing and finally narrow cases.

    Everything is OK, if I use this FGV simply in a main VI directly from the block diagram. So that I can init, write data and finally close the PDM file.

    However, for some reason, appeared a new requirement: to be able to 'Init' and 'Close' the TDMS file using the FGV, but within a dynamically called VI (a pop-up window that may not stop the execution of the appellant).

    So in primary VI, I call dynamically VI one another by using the asynchronous call (flag x 80, "call and forget" method), and it dynamically called VI fires the FGV TDMS.

    When I probe the reference of TDMS files, I can see that it gets its value correctly after the case 'Init' of fire. After this 'init' which happened (from Dynamics called VI), a location in the MAIN VI starts calling this FGV with enum action 'Write '. I can see via sensors, the case of writing Gets the same number of REF TDMS file which has been stored in the shift register after the case 'Init '.

    But even so, the VERY first function TDMS write throws an error msg "TDMS file invalid reference '! How is it possible, if the file reference is OK and the same as that created by the function 'File open TDMS' in case 'init '?

    Again, if I execute 'init' action also directly the main VI, not a third dynamically called VI, everything is OK, it works.

    I hope that my explanation is not too bad

    Thanks for the tips and if no idea, I'll try to recreate/replicate this behavior in a test project that is small, and I'll post it...

    The problem is that when the dynamic called vi stops all references that he open invalid.

    To see what I want to say, change the dynamics vi delay like 30 seconds before she stops, the savings loop works fine until the dynamics vi stops, then the error returns.

    Mike...

  • Cannot create because of hidden file hiberfil.sys.

    I can't activate hibernate on my Windows XP Home Edition because it is actually impossible to create the hiberfil.sys file. Any attempt to create the file cause error 'access denied '. I am an administrator on the computer and you can create any other file in the root directory of the system E: drive.
    Sort the list of files in the root directory, I think do not show the file. Any attempt to open the result file in 'access denied '.
    Cacls hiberfil.sys prints "the system cannot find the file specified."
    However, there are few programs that can see the file. For example, MyDefrag can show map disk file and the E:\hiberfil.sys file is considered to be a file system.
    What would you recommend to remove this invisible file?

    OK, I managed to solve the problem.
    Using disk hex editor I changed the name of hiberfil.sys to hiberfil.syt in $MFT, then chkdsk some kind restored the file and changed Hibernate service its size in current memory of the PC. The file is now visible.
    I'll check if hibernation is actually at work.

  • Error: failed to create or save new files in the folder where it was downloaded during the upgrade from Windows Vista to Windows 7

    Original title:

    Attempt to upgrade Windows Vista to Windows 7

    I try to update my Windows Vista to Windows 7. I bought to download the rom update the Microsoft store and downloaded, but when I try to start the upgrade I have a stateing message that it is impossible to create or save new files in the folder where it was downloaded. I checked the security permissions in the file and made sure that no programs are 'read only', but it won't always go beyond this point!

    Hello

    What is the edition of Windows Vista installed on the computer?
    Make sure that you upgrade to the correct version, some versions of Windows cannot be upgraded with the installation disc you are trying to use. For example, you cannot upgrade a 32-bit version of Windows to a 64-bit version, or upgrade a higher edition of Windows like Windows Vista Ultimate Edition, to a lower edition, such as Windows 7 Edition Home Premium. If this is the case, you will need to use the custom during installation option.
    Before you attempt to upgrade, please run the Windows 7 upgrade Advisor:
    http://Windows.Microsoft.com/en-us/Windows/downloads/Upgrade-Advisor
    Also, check if your computer is compatible for Windows 7, using the Compatibility Center:
    http://www.Microsoft.com/Windows/compatibility/Windows-7/en-us/default.aspx
    To learn more about the upgrade process, please visit the link below:
    http://Windows.Microsoft.com/en-us/Windows7/help/upgrading-from-Windows-Vista-to-Windows-7
    I hope that helps!
  • Re-edition of MSWMM files... HOW?

    I creator of film to windows Vista... edited several and unfortunately, hit publish... now, they are. MSWMM files.   I can not open them or modify the code... I would like to re - edit these files... but I can't open them to all the windowsmovie Maker nor change them a program AVS... What can I do?

    I creator of film to windows Vista... edited several and unfortunately, hit publish... now, they are. MSWMM files.   I can not open them or modify the code... I would like to re - edit these files... but I can't open them to all the windowsmovie Maker nor change them a program AVS... What can I do?

    ===================================
    .mswmm files are project files Movie Maker... they
    are useful for a re-release in Movie Maker. NO.
    another program accepts files and they cannot
    be converted.

    What happens when you try to reopen a .mswmm
    file in Movie maker?

    I was wondering have you created with the default files
    Movie Maker 6 and then update Live Movie Maker?

    John Inzer - MS - MVP - Digital Media Experience - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • How to dynamically create action item?

    Hi, I want to dynamically create point.

    Before I want to create using qml, but does not seem possible

    http://supportforums.BlackBerry.com/T5/Cascades-development/how-to-create-action-item-of-page-dynami...

    So maybe better to use C++ to create dynamically,

    I'm already try but are still not

    So I have a custom control qml (a Navigation pane)

    name List.qml

    the structure is like this:

    NavigationPane {}

    {Page}

    objectName: myPage

    {Of container

    ....

    }

    }

    }

    How to add action item to this .qml?

    I'm already try that, but failed

    C++ :

    Engine QDeclarativeEngine;

    QDeclarativeComponent component(&engine,QUrl::fromLocalFile("List.qml"));)

    QObject * object = component.create ();

    Page * myPage = object->findChild ("Edit");  Maybe, on that note, I'm wrong implemented? -> not found?

    ActionItem * action1 = ActionItem::create () .title ("first action");

    my page-> addAction (action1, ActionBarPlacement:nBar);

    Remove the object;

    How to create this dynamic Action item?

    Help, please

    Thank you

    Hello

    QML, the object name must be included between "" marks.

    Name of the object of your Page will be:

    objectName: "myPage"
    

    You can reach any CPP QML object like this:

    This excerpt comes from YourProjectName.cpp

    // create scene document from main.qml asset
    // set parent to created document to ensure it exists for the whole
    // application lifetime
    
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
        // create root object for the UI
        AbstractPane *root = qml->createRootObject();
        // set created root object as a scene
        app->setScene(root);
    
    //and here comes the findChild method
    Page* qmlPage = root->findChild("myPage");
    

    After this, you can create any object on the side of C++ QML, as your own code:

    ActionItem* action1 = ActionItem::create().title("First action");
    myPage->addAction(action1, ActionBarPlacement:nBar);
    

    Don't have no need to create a QObejct, or declarative stuff.

  • Do what the SECURITY settings - I have to change to allow my second computer to access, edit, and save files on my first computer?

    I have 2 computers ion my household. Both computers must be able to access, read, edit and save files to another - word, excel, etc. For some reason any while the 2nd computer can access and read files on computer no. 1, he cannot edit or save files on computer no. 1. It cannot create folders in the other computer. Efforts to make this result in "you do not have authority - permission to the administrator '-How do I do when I don't know what to change and where?

    You can take a look at the following links:

    http://Windows.Microsoft.com/en-us/Windows/file-sharing-essentials#1TC=Windows-7

    http://TechNet.Microsoft.com/en-us/library/cc726004.aspx

    http://TechNet.Microsoft.com/en-us/library/cc753521.aspx

Maybe you are looking for

  • I have no renewal of the subscription on itunes or my iphone 6

    Hello I want to buy an app with subscription... For some reason I don't have not the button manage on my iphone or my itunes. I used this guide: view, change or cancel your subscription - Apple Support iPhone: 6 Last updated Could you please help me?

  • How to connect by Satellite Pro C to TV?

    Hello worldThank you. I would like to connect my C series to my TV.The C series has only one external video Port.My TV has RCA inputs and a SVHS, S_Video entry imput. Can anyone help?John

  • his studio DTS: password administrator or power on password

    I stuck on disabled system 75174891 after 3 password attempt

  • Error 80244019

    On startup, I get an alert: "Windows can't check for updates. Clicking on resulting in a me to updates, click on ' check for updates ' brings back an error message: 80244019. This brings me to help and Support and I do what is proposed here - a full

  • How can I restore my laptop to the original without a backup disk settings

    Remember - this is a public forum so never post private information such as numbers of mail or telephone! Ideas: i have a laptop of hi quality and was not provided with a backup with the purchase.how disk do my original rear 2 portable format You hav