A loop in the properties of a custom class

Hello

I have a class with a number of properties that are of different types (String, Array, class custom, etc.). I want to be able to loop tthrough each of these properties. I tried the following code:

var testObj:myClass = new myClass();
for each {(element var testObj)
trace (element);
}

I looked in the debugger, and it does not go inside the loop "foreach". I made a mistake, or is there another way to do it?

Thank you very much in advance for any help

Pierrot

Who will work for the (associative) dynamic properties, but will not work
for the properties of the class.

For the properties of the class, you will need to use something like this:

import flash.utils. *;
function getObjectPropertyNames(o:*):Array
{
var result: Array = new Array();
var t:XML = flash.utils.describeType (o);
var l:XMLList;
If (o is Class) {l = t.factory.accessor ;}
else {t = t.accessor ;}
var node: XML;
for each (node in l)
{
result.push ([email protected] ())
}
return the result;
}

var testObj:myClass = new myClass();
the accessories of the var: Array = getObjectPropertyNames (testObj);

Dynamic properties
for each {(element var testObj)
trace (element, testObj [element]);
}
Properties of the class
for (var i: int = 0; i
trace (props , testObj [accessories]);
}

Tags: Adobe Animate

Similar Questions

  • Is there a way to loop through the properties of a layer groups and JUST get those that are visible?

    Hello

    I'm trying to get just the property groups that are visible to a layer in my script. Is there such a property?

    For example, when I loop through groups of properties of a shape layer, I get masks, layer, surface Options and Audio property groups Styles, when none of these are appropriate. I tried to use the (.elided) property, but it gives me just the 'Content' hidden folders within the groups of vector and 'Masks' in 'membership Options '.

    * on a side note, I got the error "not"adjustable expression"with this property, because the property is a property of the parent is hidden." When you try to access X or Y Rotation on one layer 2D. It makes it seem like there is somewhere a Boolean value 'hidden' in the property object, but I can't.

    Hello

    'elided' and 'hidden' both have purpose UI (make the lighter user interface) but are very different:

    • 'j' is a static property groups attribute (readonly, and After Effects never becomes the value internally).

    The children of an elided group are not necessarily élidés.

    • 'hidden' is NOT an attribute, is dynamic and "undocumented".

    The UI of effects after mask everything that is not necessary in the layer property tree (for example the Group of hardware options is hidden when the layer is not 3D, because it is not used anyway).

    Properties and masked groups are always there and is accessible by script, you can read their values and attributes, Scout their subtree of property, but we cannot define anything on them or select them (in both cases, that an error is generated).

    And the children of a hidden group are hidden.

    Since there is no corresponding to 'hidden' attribute, it is uncomfortable to know whether or not a property is hidden. I only see one case of 'treatment '.

    For example:

    myLayer.layerStyle is hidden? <===>! myLayer.layerStyle.canSetEnabled

    myLayer.transform.xRotation is hidden? <===>! myLayer.transform.xRotation.canSetExpression

    myLayer.mask is hidden? <===>myLayer.mask.numProperties = 0

    myShapeLayer.content is hidden? <===>fake (never hidden, even if it is empty)

    etc...

    Xavier.

  • A loop in the properties of the object?

    Hello

    I have a clip with the 'class name' block, I'll use this object more than once in the stadium, so I need a loop through it, I was able to do, but I can't access their properties (x, y, height, width, etc...)

    Here is the code:

    ------------------------------------------------------

    blocks of var: Array = new Array;

    blocks is the table that contains the movieClips

    for (var i = 0; i < numChildren; i ++)

    {

    If (getChildAt (i) block)

    {

    should what I write here to make the variable blocks [i] a movieClip and access its properties?

    }

    }

    ---------------------------------------------------

    Thank you

    If you still want to take the approach that you have started, you probably don't want be melting blocks on the value i if there are children who are not block objects.

    If (getChildAt (i) block) {}

    blocks.push (MovieClip (getChildAt (i)));

    SomeProperty = MovieClip (getChildAt (i)) .someproperty;

    }

  • Passing arguments to a custom class of MC constructor

    I have problems with the Builder for a custom class linked to a MovieClip library.

    I have a MovieClip in my library called circle, which is related to the com.shapes.Circle class. I want the contstructor of class circle to take 2 arguments, xScale and yScale:

    public function Circle (xScale:Number, yScale:Number) End Sub

    However, if I try to call it from code, for example ball circle = new Circle (3.14,2.0); , I always get a 'number of Incorrect arguments. Waiting 0 " error.

    Is it possible to have a custom class linked to a MovieClip that can take arguments, or Flash not allow this? I had asked about this before and thought I figured out, but look at it now, I apparently had not thought of it and has resorted to a workaround sloppy; I'm hoping to fix now.

    Library items cannot have constructor arguments, because the user can drag on the stage and in this way has no way of passing arguments. If you wat to initialize instances, define public void init() where you can add as many arguments as you want.

  • Hi, I'm new to animate so please be patient if this is a silly question. Problems with receiving the option loop 'play once' in the properties panel to work.

    Hello world

    I created a graphic symbol, then a test fast and then selected animation symbol on the stage (this did not bring the loop for me option in the properties panel initially), when I chose the last keyframe of the animation in question then selected the symbol on the stage, I was then only able to access the loop drop-down list in the properties panel. However, after you select 'play once' and test movie he continued to loop.

    Has tried to enter the symbol (in vase clos-sorry not sure of the exact terminology) and created the animation, then left the isolation and made sure that the animation was enough images in the scenario main and tried and still had a continuous loop.

    I used the stop(); action on a clip before that worked well, but who did a very basic animation; This requires several objects moving and stop at different times and I found the stop action interrupts the entire animation at that time here.

    So I have 2 questions:

    How we use the function 'play once' to make it work because that seems like the easiest option for what I want to achieve.

    Or how to effectively use code to stop and start the animation when I need to?

    Thank you in advance for your help!

    publication settings, disable loop timeline

  • To access the properties of the custom class

    Hello again! Nevermind, I got display list order because it has me even more trouble :)

    I have several items stacked from the other (boxes) and you want to calculate the height of all the underlying boxes for each box. Each box is an instance of a "Kiste"-custom class that has a property "hoehe" (height). "." Usually, I can access this property from anywhere and it works fine. But in the following case, it won't. The alles.getChildAt(j-1) works fine with all other assets, but not with custom properties that I defined in my class?

    OK, get it myself... Type cast!

  • TDMS set the properties in a loop?

    I use LV 8.5 and try to apply the properties of PDM to multiple channels at once, with the idea of being able to automate to the number of channels currently active.  I don't know how to proceed, with the exception of one step, with that I fight.  I get the error message:

    "LabVIEW: an input parameter is not valid." For example if the input is a path, the path can contain a character not allowed by the operating system such as? or @.
    =========================
    NOR-488: command requires GPIB controller charge controller. »

    coming from the set PDM of the properties.  I am feeding it a string array indexing, C-string terminator null as said help files which seem to me he struggles with these and not addresses.  I have attached a partially completed VI working otherwise.

    Thanks for your help,

    Bret Dahme

    I think that if wire you a channel name, you should also connect a group name (cannot be an empty string). The expected behavior is that the VI must be broken if we plug only the name of the channel. This doesn't seem to work, if. Going to be looking at why this is.

    Herbert

  • Custom Windows photo viewer photo I shot as he says there is something wrong with the properties of image file, what can I do?

    I took some pictures on my iPhone 4 and saved on the laptop, but some are out on the side for a reason, and now when I try to turn, they cannot be saved, what is wrong and what can I do?

    I took some pictures on my iPhone 4 and saved on the laptop, but some are out on the side for a reason, and now when I try to turn, they cannot be saved, what is wrong and what can I do?

    ===============================================
    I don't know if the following links answer your question, but
    they may be worth a visit:

    Good luck and * proceed at your own risk *.

    FWIW... There is a very long discussion (several pages) to the
    following link:

    Cannot change the imported iPhone 4S photo
    https://discussions.Apple.com/thread/3444951?start=0&TSTART=0

    More Discussion

    iPhone 4S image properties is not compartible with Windows?
    Editing can be done on the computer due to the error
    "Windows Photo Viewer cannot save changes to this picture.
    because there is a problem with the properties of the image file".
    Any help?
    https://discussions.Apple.com/message/17291884#17291884

    More Discussion:

    We cannot turn a few photos in Windows 7 (but can turn others)
    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-pictures/cant-rotate-some-photos-in-Windows-7-but-can/3a809845-9144-4BB1-9bb3-ab4f5b856524

    A simple solution is to open the photos in paint or most other
    digital image editor and modify it.

    Some people have reported success using the following free download
    to remove the metadata.

    Property restrictions stripper iphone 4S (JPEG & PNG Stripper)
    http://www.SteelBytes.com/?mid=30&cmd=download&PID=15

    Here's a way to turn...

    Easily turn locked iPhone 4 and 4 s Photos in Windows 7 with
    the rotator Lossless JPEG free
    http://www.daleisphere.com/easily-rotate-locked-iPhone-4-and-4S-photos-in-Windows-7-with-the-free-JPEG-lossless-Rotator/

    Free download JPEG Lossless rotating
    http://annystudio.com/software/jpeglosslessrotator/

  • Properties of the label and the custom class

    I want to do the following persistent: < mx:Label useHandCursor = "true" buttonMode = "true" mouseChildren = "false" / >

    I tried to create a custom class that extends the class Label, but we can't get the syntax right.

    protected override?

    buttonMode = true;

    I don't think I want to replace a function.  It seems to me that I want to override a property or attribute of the Label class.

    Can someone give me advice?

    Hello

    As you Lable with the default property {useHandCursor = "true" buttonMode = "true" mouseChildren = "false"}

    I extend the label, you can do it directly in the constructor by setting

    -Custom label class-

    package
    {
    Import mx.controls.Label;

    SerializableAttribute public class CusLbl extends Label
    {
    public void CusLbl()
    {
    Super();
    super.buttonMode = true;
    super.useHandCursor = true;
    super.mouseChildren = false;
    }
           
    }
    }

    --------------------------------------------------------------------------------

    You can use directly in the application or in any other container with the default property;

    See attached the file if necessary.

    Regarding

    Virat Patel

  • To access the properties of an Error Message When you use the DisplayRunTimeErrorDialogEx method

    I have a reminder that displays the standard runtime error dialog box using the method Engine.DisplayRunTimeErrorDialogEx of custom error. http://zone.ni.com/reference/en-XX/help/370052H-01/tsapiref/reftopics/engine_displayruntimeerrordial....  The parameters of this do not allow me to specify information about the error message available (via the properties of the stage of the appeal of error).  However, when built-in bed in treated TestStand display dialog runtime error through its methods of error handling he managed to fill in the details about the error.

    Anyone know how I can fill in the details and the error code from the dialog box fields when you use the DisplayRunTimeErrorDialogEx method to call it? See attached screenshot by one example of what I get when I use this method.

    Kind regards

    David

    Doug is correct; each sequence in the call stack has its own sequence context, so if you just "ThisContext" for the sequence context parameter, you provide the framework for the error callback, which has no error.  To access the context of the sequence that wrong, you use the caller property to get to the next level in the call stack, for example:

    RunState.Engine.DisplayRunTimeErrorDialogEx ("error Dialog", ThisContext.Caller, 0, False, False, False, False)

    I hope this clarifies!

  • Loop through the sequences selected using set of entry points into LabVIEW OI

    Hi all

    I have an operator Interface where the operator has the option to select specific measures and loop over the sequence selected according to the needs.

    Everything works as expected, but the customer wants to remove the default loop configuration pop-up box.

    Must be defined by programming the parameters of the loop (and not by the user). I figured out how to build arguments interactive but don't know how to spend it.

    Any ideas / suggestions would be greatly appreciated.

    Thanks in advance.

    Kind regards

    SS

    UnspecifiedError wrote:

    I am aware of this method and it works well, but the requirement is to run with the model process for example 'Test DUT' entry point

    Use SequenceViewMgr.ExecutionEntryPoints to get the corresponding entry point object, and then use EntryPoint.LoopOnSelectedSteps ().

    Hope this helps,

    -Doug

  • How to transmit frames CAN cyclically inside a loop obey the emission data informed BCD?

    Hi all!

    I don't know if I don't completely understand the behavior of the situation below. I use LabVIEW 2014 and PXI-8513 card under Windows.

    NOR-XNET help reading I understood:

    Cyclical data : the data frame transmitted cyclically (periodical). The period is defined in the "transmission data" field in the properties BOX of the framework in the DBC file.

    But how the transmission time can obey informed transmission data in DBC file if I call the XNET write VI in a loop with a waiting inside? I don't know if I fully understand how it works in a while loop.

    I watch the program below, how writing would behave?

    While the loop contains a "wait until the next multiple ms" 100 and the signal selected database (dbc) has a transmission time of 0.02 s (20ms), how many times would the framework passed in the first loop?

    If your answer is "Although the time of transmitting the frame is 0.02 s in this case writing is written only once", I have another question: How can I keep a loop writing frames obeying the time of transmission of the image of the CBD? Consider that I have signals selected different frameworks at different times to transmit.

    Thanks in advance!

    When you use the XNET write Point with Single mode, it updates the value that will be transmitted according to the schedule specified in the XNET (DBC file) database. If you call multiple entries before the frame was transmitted, only the last value written shuts down during the NPC.

    If you look in the help file XNET under the API OR-XNET for LabVIEW-> Sessions-> Modes of Session, you will find information, including an example of how it works.

    In your example - if you have a timing loop of 100ms, but your message cyclic time is 1s, then will send you only the last value of 'editorial' more message cycle time. If your timing loop is 100ms, but your message time is 10ms, so you pass the value even 10 times (about... windows calendar and all that).

    In essence, you CAN transmitting frame continues to run in the background according to the time where you specified in the DBC file, but you can then update the values which are transmitted asynchronously using the single-point VI write.

    If you want to check the values passed are updated every time - you must use the stream or queue mode and your frames to the output of the buffer. That, or you must use a RT target that can update the data in a deterministic way.

  • How a single change of ownership of XY Graph Plot.Style default or change the properties od individual plots?

    I have a XY Chart with a variable number (known) of several plots. The number of plots may vary, the style of track sometimes isn't what I want. I am trying to use a property node in a loop for change the properties Plot.LineStyle, Plot.PointStyle, and Plot.Fill/PtColor for each parcel in a XY Chart. However, perhaps because the names aren't static, colors do not seem to be updated I would, and I'm really not sure why this happens. Strangely, the LineStyle and PointStyle seem to be updated as I'd like.

    Please see the ScatterColors.zip enclosure that contains the main VI in question (SplitInGroupsScatterByOrder.vi) and two screws under which it depends. Thanks in advance for your help

    So, I thought about it for me. I did the stupid mistake to think that the 'Name of the conspiracy' property was a reference, to select, by parcel name, field properties, which were being changed. Now, I understand that the "Tracer Active" property is the way to do that, while the Name property to draw allows (surprise, surprise) to change the name of a parcel.

  • change the properties in real time

    Is this possible?

    I have a digital command and a loop for. I would like to change the propertis of num control so that it increments as the Terminal counter, i.e. control number is a multiple of the meter. The user can run the loop for x times those and another times y times. Digital control are editable as it is a multiple of the value?

    Thank you.

    Yes, you can change these properties at run time (real-time is something different).

    Right-click on the control terminal, select Create-> property-> data-> incremententry limits.

    Good luck.

    tone

  • For a given file, how to add and change file properties on the Details tab, for properties that are not in the properties list?

    Now, I am aware of the modification of the properties of the file is simple in Windows 7 Explorer. Select a file, 'Properties', then tab "Details".  Some are not editable, and that's understandable.  Click on next to any area classified as year, Genre, Publisher, etc. and the apply.  No problems so far.

    Then of course in Explorer, when you right click on a column header, you get several choices of column beyond the usual that is displayed by default; Date, the Type, size, etc.  But, there is an option "More...", which has up to now, MUCH more useful properties to choose from, such as the model project, Department, job statusand so on.

    It's fantastic!

    But when you look into the details of any given file, none of these additional properties even are listed to be edited.  Why offer to view these details, if you don't change them, or add them to different files?  I must be missing something.  I do not need to add my own custom details, this additional list has a choice, that I need; If only I could edit the files to get this info.

    How to add and change these properties to files?  Word, Excel, MP4, AVI, JPG; I would add these properties, so I can set directly in the Solution Explorer, as you would by name or Type.

    Any help would be greatly appreciated!

    My experience is that most of these 'extra fields' no existence not as fields in the directory (folder) itself.  On the contrary, these fields exist in the target file itself. Each file type has its own format and established file except for the types of files that belong to Microsoft, Microsoft cannot control or arbitrarily change the format of a particular file type.

    For example, a ".jpg" file  The format of this file type allows a large number of areas such as comments, Tags, date taken, opening, device manufacturer and so on.  If you go into the properties on a .jpg file, you will see a lot of them and will be able to change.  After changing any of these fields, you will find that the file itself has been changed to contain this information (as can be verified by the parity of the file and to come check upward with a different checksum).  If you display one of these fields in Explorer and 10000 ".jpg" files in this folder, then Explorer must open each of these 10000 files to extract the data in the corresponding fields, you have chosen to display.  May take some time.

    Compare that to the same picture saved to a file ".bmp".  The ".bmp" format has no provisions for any of these fields, so you will not be able to view, save, edit, or sort by them.  If the editable fields are directly related to the type of file that is displayed.

    Microsoft has apparently interviewed a lot of file types and made a compilation of the editable fields in each type of file and the Union of the selected fields in which can be displayed and modified.   That's apparently what you see in the option «More...» ».   So, in summary, the file type determines which fields are available for editing and posting.

    HTH,

    JW

Maybe you are looking for