Generate dynamic objects in Flash

I'd like to use a conditional loop to generate objects dinamically and i'd like to know if it is possible to do this in Flash.
I try to explain better what i want to do; i have to let users to choose a number of balls to display on the stage, something like this:
var balls; //it contains the numbers picked by the user
if ( balls == 0) display nothing on the stage;
if ( balls != 0){
for (n < balls){
plot a ball on the stage
How it is possible to generate objects by looking on user decisions?
At the moment, i just know how to add a given number of objects on the stage and how to arrange them, but i do not know how to generate them depending on the user choices.
Can you help me?
I tryed to search on google, but i found nothing: what kind of tutorial should i read to accomplish this task?
Thanks to all.

The first thing you should do is get the code off of the button and into the timeline.  Placing code on objects is not a healthy practice. Also, you do not want to place the object is the same depth... they cannot co-exist there.  Give the button an instance name (maybe "btn"), and in the timeline use the code...
btn.onRelease = function(){  
     for(i=1; i<=3; i++){ 
        main.attachMovie("att1", "newname"+i, main.getNextHighestDepth(), {_x:100, _y:100});
        main.attachMovie("tavolo", "prova"+i, main.getNextHighestDepth());

Similar Messages

  • Error #1056, creating dynamic object

    Hi,
    I am simultaneously creating an object and adding it to an array, perhaps ill-advisedly. The following code worked on the main timeline, but not when I moved it to the constructor of a document class:
    package {
         import flash.geom.Point;
        import flash.display.MovieClip;
        public class IconTour extends MovieClip {
            var thePoint:Point = new Point();
            var defaultColor:Number;
            var overColor:Number;
            var iconCreationList:Array = new Array();
            //var xx:MyIcon;
            public function IconTour(){
                thePoint.x=50;
                thePoint.y=300;
                defaultColor=0x7dc2df;
                overColor=0x788dec;
                iconCreationList.push(this["xx"+iconCreationList.length] = new MyIcon(thePoint,"folder","Text for the folder", "Folder", defaultColor, overColor));
                for each (var iconObject:MyIcon in iconCreationList) {
                    addChild(iconObject);
    The following error is generated:
    >ReferenceError: Error #1056: Cannot create property xx0 on IconTour.
        at IconTour()
    I guess this is because xx0 isn't declared? How does one declare a dynamic object/variable?

    Nope. No mention. However, I guess I don't need to dynamically create a variable as this works:
    iconCreationList.push(xx = new MyIcon(thePoint,"folder","Text for the folder", "Folder", defaultColor, overColor));
    iconCreationList.push(xx = new MyIcon(thePoint,"assignments","Text for the assignment", "Assignments", defaultColor, overColor));
    where this does not:
    iconCreationList.push(this["xx"+iconCreationList.length] = new MyIcon(thePoint,"quiz","Text for the quiz", "Quiz", defaultColor, overColor));
    iconCreationList.push(this["xx"+iconCreationList.length] = new MyIcon(thePoint,"assignments","Text for the assignment", "Assignments", defaultColor, overColor));
    AS doesn't care if I add more than one object to the array that is named xx. I probably won't be referencing xx by that name anyway, just by iconCreationList[1].

  • Could not generate stub object - The element type "META" must be terminated by the matching end-tag "".

    I am getting the following error message when I try invoking
    a webservice.
    Could not generate stub objects for web service invocation.
    Name: ProgrammePrivilege. WSDL:
    https://clientaccweb.reseaudistinction.com/CardHolderInfo.asmx?WSDL.
    org.xml.sax.SAXException: Fatal Error: URI=null Line=11: The
    element type "META" must be terminated by the matching end-tag "".
    It is recommended that you use a web browser to retrieve and
    examine the requested WSDL document for correctness. If the
    requested WSDL document can't be retrieved or it is dynamically
    generated, it is likely that the target web service has programming
    errors.
    The problem is, the webservice is working fine, the
    application was working yesterday, the error message just appears
    after a couple of days and I have to refresh the service in the CF
    Administrator. Once I refresh it, everything starts working again.
    Anyone else got this problem? ANY help would be appreciated!
    If you guys need my code anyway, I can attach it but like I
    said, everything works for a couple of days, then, out of the blue,
    it stops working so I doubt that it's my CFINVOKE that's the
    problem...

    Similar kind of problems here - reported back to Adobe a
    couple of months ago, so let's wait and hope for the best. My
    problems have related to registering multiple web services and
    executing them. One problem is that, If I register two identical
    (and quite complex) web services, I can only execute either of
    them. After CF restart, either of them works, but invoking the
    other doesn't work.
    For example; CF_Restart -> Try A first, A works -> B
    doesn't. Also, CF_Restart -> Try B first, B works -> A
    doesn't.
    CFMX7.0.2, Apache 2.2, WinXP

  • Can't get dynamic text in Flash 8 pro to work

    Hi,
    This is driving me nuts. I am using SWObject to send a
    variable to my Flash 8 swf. The swf is basically a header that
    plays a video and I want to put the name of the web page
    dynamically on top of it. Sounds simple right. Well I can not get
    it to work. In the past I have done dynamic text boxes without any
    problem.
    I have uploaded all the files to my clients server (
    including the fla and the HTML page that accesses the swobject code
    I have also tried other more conventional means to load the
    Variables ( in the URL address and using Flashvars with a normal
    object and embed tag ) Nothing seems to work.
    Is there a problem with dynamic text and Flash 8?
    I'm pulling my hair out any help would greatly be
    appreciated, Thanks in advance.
    Zip file on the
    server with all the files

    Hi jimWPX, I have no problems with dynamic text in Flash 8,
    and I see no problems in your file.
    Could it be that the js doesn't parse for Flash 8 correctly?
    A quick check for version seems to suggest that it's embedding with
    tags for v 6 Flash. Might be problematic.
    An alternative is FlashTag.js,
    http://www.macromedia.com/go/flashjavascript/
    which works fine for me also. Hope it helps

  • How to use an dynamic text from Flash in FlashBuilder with swf ?

    Hello,
    i'm trying to develop a game in flex builder and i got a problem with the dymanic text i've imported from flash. I want to insert a scoreboard in my application and for doing that i should use dynamic text in flash. I create a dynamic text in flash and then a import it to Flash Builder in a movie clip, and i called the dynamic text "Score". Now i've tried to use the "Score" variable to change the value of the dynamic text box un my flash builder application, but it doesn't change anything.
    I read somewhere that i've got to use the score.text value to change the number of my score but that doesn't works because Flash Builder tells me that this sort of variable don't contain the .text value.
    Thank you for trying to help me.
    bye.

    Thanks Ned,
    I always welcome learning something new.
    I did not know creating a new keyframe,
    creates a new instance.
    Yes, I had used the same dynamic text field instance name in
    numerous, new layers (great observation).
    With the objective to display the User's name throughout
    the timeline (on and off)...
    I'll attempt to paraphrase your solution;
    Use a single layer to display the dynamic text field.
    Extend this layer's timeline throughout the movie, or end use of the dynamic text field.
    Help with this one ??
    Set the visible properties to true or false as need through out the timeline.
    ( Does require an AS3 ? )
    I'll give that a try.....
    ~~
    Side of effect of using the above solution;
    The SWF in it's attempted state, uses the dynamic text field instance, in
    different places, different text sizes, on the stage, throughout the Movie.
    (i.e. the User's first name appears in different sentences...)
    Per the solution above,
    I believe I will be limited to One location, one format setting.
    Is this assumption correct?
    I can make this work from a display / Movie point of view.
    However, your first VAR concept, noted above, might be
    worth exploring should more flexibility be required.
    Thanks for making the time to coach...
    D-

  • EventListener function specific to generated display object container

    This has to be simple, if only I knew how. I'm an AS3 newbie,
    and am having difficulty setting up multiple specific
    EventListeners within a code generated display object container.
    I am generating a 'page' (Sprite) with a heap of 'cards'
    (Sprites) on it. Each of those cards, in turn, contains a selection
    of text boxes and other objects generated from database output
    using a 'for' loop.
    My hope is to attach an EventListener to each 'card' so that
    a MouseEvent will let me manipulate the data that lead to the
    content of that actual card (the i-th iteration of my for loop).
    I've been playing with everything I can think of (limited
    repertoire of thoughts though) and the best I've managed is for my
    EventListener to access the final set of data, whichever 'card' I
    click on.
    I've summarised and attached my code for the function, and
    would appreciate any advice (however basic) on how to get back to
    the i-set of data from the EventListener attached to the i-th card.
    I can handle the PHP and MySQL side of things but am fumbling my
    way into the OOP of AS3.
    Cheers
    Dougal

    Another way would be to extend Sprite and add an id value.
    Something like:
    package{
    import flash.display.Sprite;
    public class MySprite extends Sprite {
    private var _id:int;
    public function MySprite(id:int){ _id = id; }
    public function get id():int { return _id; }
    And then in your code you'd just make instance of MySprite,
    passing it i:
    // build the cards and text boxes and add them to the
    reviewPage
    for (var i:int = 1; i < (cardsRequired+1); i++) {
    // setup the locations for all the objects
    var displayCard:Sprite = new MySprite(i);
    You can then get i in the event listener function by using
    the id getter:
    function accessThisData(e:MouseEvent):void{
    trace(e.target.parent.id);
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Cannot generate stub objects...access denied

    Has anyone come accross this?
    I am attempting to access a coldfusion 9 webservice that I created and am also consuming.  The pair works fine when both requesting page and the webservice are resident on my development server, but generates the following error when in production:
    Error Occurred While Processing Request
    Cannot generate stub objects for web service invocation.
    Name: http://casadiablo.homeip.net/WebServices/SimpleWebService.cfc?wsdl. WSDL: http://casadiablo.homeip.net/WebServices/SimpleWebService.cfc?wsdl. java.security.AccessControlException: access denied ("java.io.FilePermission" "C:/Program Files/Java/jdk1.7.0_04/jre/lib/wsdl.properties" "read") It is recommended that you use a web browser to retrieve and examine the requested WSDL document to ensure it is correct. If the requested WSDL document cannot be retrieved or is dynamically generated, it is likely that the target web service has programming errors.
    The error occurred in D:/home/casadiablo.net/wwwroot/indexCDNet.cfm: line 10
    Called from "java.io.FilePermission" "C: line -1
    Called from "java.io.FilePermission" "C: line -1
    Called from D:/home/casadiablo.net/wwwroot/indexCDNet.cfm: line 10
    Note: the wsdl renders just fine in a browser at the address I'm using so it's not a can't find it or location issue.  I'm no expert in reading wsdl files, though, so it could render some clues if I knew what to look for.
    For context:
    When I go from my development environment to production, the consuming page is on casadiablo.net/indexCDnet.cfm (hosted by Hostek).  The webservice is on a PC in my home that has a dedicated IP address. 
    I've searched all over for an "access denied" java error (related to CF web services) discussion and have found nothing.  Any ideas as to how to troubleshoot where in this chain a java.io.FilePermission error might be triggered would be greatly appreciated!!
    Message was edited by: CFsolar
    Case solved. It turns out that this is totally a Hostek issue.  After exhausting all other options (including uninstalling and reinstalling java), it was a setting on the security sandbox that caused the error.  Well at least this will be out there for anyone else working with webservices and Hostek!

    Did anyone ever resolve this issue as I seem to be having the exact same issue???

  • Could not generate stub objects for web service invocation in ColdFusion

    I was able to call the services on the development box - windows server without any problem at all, everything was working fine but the moment i uploaded to a linux box production server I get this error. "Could not generate stub objects for web service invocation in ColdFusion"
    What could be the cause of this problem, i have googled a lot but no solution yet any ideas.

    Let me make it simple:
    1. Server A is our development server.- hosted inhouse with coldfusion installed.
    2. Server B is our production server - a linux server with coldfusion installed hosted on the internet
    3. Server C is a third party server containing the webservice - this is a windows server with .net
    coldfusion is installed on Server A, the code works here and can connect to server C without any problem. It gets the required respone
    but when the code was uploaded to server c it gives the error when we run it.
    now i tried just a simple code which works fine on server A below:
    <cfinvoke webservice="http://www.webservicex.net/CurrencyConvertor.asmx?WSDL" method="ConversionRate" returnvariable="ConversionRateResult">
        <cfinvokeargument name="FromCurrency" value="EUR" />
        <cfinvokeargument name="ToCurrency" value="USD" />
    </cfinvoke>
    <cfdump var="#ConversionRateResult#" />
    But when i uploaded it to server C: it returns the error
    Cannot generate stub objects for web service invocation.
    Name: http://www.webservicex.net/CurrencyConvertor.asmx?WSDL. WSDL: http://www.webservicex.net/CurrencyConvertor.asmx?WSDL. java.io.FileNotFoundException: /opt/coldfusion8/stubs/WS728929035/NET/webserviceX/www/Currency.java (No such file or directory) It is recommended that you use a web browser to retrieve and examine the requested WSDL document to ensure it is correct. If the requested WSDL document cannot be retrieved or is dynamically generated, it is likely that the target web service has programming errors.
    The error occurred in /home/works/public_html/currency.cfm: line 7
    5 :     <cfinvokeargument name="FromCurrency" value="EUR" />
    6 :
    7 :     <cfinvokeargument name="ToCurrency" value="USD" />
    8 :
    9 : </cfinvoke>
    Now if you try the preceeding code on a windows environment  it works fine but the moment you put in the in the linux environment it generates this error
    I feel that the error may actually be :
    java.io.FileNotFoundException: /opt/coldfusion8/stubs/WS728929035/NET/webserviceX/www/Currency.java (No such file or directory)
    but i am clueless as to what to do next
    Ok so I tried the wget command on the linux
    this is what i got
    -bash-3.2# wget http://www.webservicesx.net/CurrencyConvertor.asmx?WDSL
    --2011-07-02 23:23:42--  http://www.webservicesx.net/CurrencyConvertor.asmx?WDSL
    Resolving www.webservicesx.net... 216.8.179.25
    Connecting to www.webservicesx.net|216.8.179.25|:80... connected.
    HTTP request sent, awaiting response... 403 Forbidden
    2011-07-02 23:23:43 ERROR 403: Forbidden.

  • Fetching Dynamic Object issue

    Hi all,
    Instead of define an variable as external (due to size limitation), I decided to use session.getInstanceData to obtain the value in an instance variable. While things works well on my environment, it does not work out in the QA environment. The following is how I do it:
    DynamicObject instanceData =
    session.getInstanceData(instanceInfo.getId());
    Map dataMap = instanceData.asMap();               
    //Get screening result
    String resultStr = "";
    boolean hasResult =
    dataMap.containsKey("screeningResults");
    if (hasResult){
    Object resultValue =
    dataMap.get("screeningResults");
         resultStr = resultValue.toString();
    I have also log the content of screen result inside the activity:
    logMessage("leaving ... "+this.activity.name +" with screening results="+ this.screeningResults);
    At my environment, I can see the content pass from the engine back to PAPI. However, on QA environment, I see the content show on the engine log (due to the logMessage) but PAPI gets empty string back.
    At first I thought it is due to the "Max Instnace Size limitation", so I upped the limit to 2000kb, but it still doesn't solve the issue. So anyone got any idea what did I do wrong or forgot to handle? Thanks!
    Matthew

    Can I create dynamic object?Depends what you mean by "dynamic object." That term is not part of standard Java parlance, AFAIK.

  • Error while generating runtime objects in SEGW

    Hello Experts,
    we are facing this issue when trying to generate runtime objects in SEGW. please find the attached image for more details.
    Repaired objects cannot be included in dev./correction &I3DK910030&’.
    Thanks and Regards,
    Mallik

    Hi,
    well, I guess if you mean you did reset the queue - you deleted all emtries with error. Try to avoid this in the future - you will get unwanted side effects by that. There are only a few errors that make this behaviour necessary.
    Usually you should select the entry on the first screen - so you see the status of the queue on the second one. On there you can select the queue and while pressing the green tick, you can restart it. If it is a timeout - this restart usually helps.
    Wondering why you have an issue with basis objects - did you run through the complete setup guide up to this point?
    Regard,
    Oliver

  • Unable to view settings tab in one GPO. "An error occurred while generating report: Object reference not set to an instance of an object."

    I am the owner of this GPO and I can view the settings tab in any other GPO. But, I get the following message when I try to view the settings tab in one particular GPO:
    An error occurred while generating report:
    Object reference not set to an instance of an object.
    Other posts I look at reference the same error, but with different circumstances, and thus, they specify that the hotfix is for to fix the error under
    those circumstances.
    I'm accessing GPMC on a Win 7 SP1 machine. DC is Server 2012 Standard.

    > Since I have to go through Edit to see the settings, and peruse the
    > entire massive folder of settings to try to identify the bad one, it has
    > been slow-going and I haven't found it yet.
    You can filter ADM templates to show configured ones only, and you can
    use the "show all settings" node. This will speed the work up - a little
    bit at least :)
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

  • GPM Custom GPO-Settings: An error occurred while generating report: Object reference not set to an instance of an object.

    Hello,
    As you can tell from the title of this question, I am no expert with GPO's.  Before I begin, I spent a few minutes to an hour searching and reading in hopes of finding the solution and avoid putting myself out there as a "GPO Newb".  While
    I found several posts and answers that were similar and were related, the questions and answers were more advanced and did present the solutions providing the person had initial knowledge already.  That is not necessarily my case and I would ask for a
    little patience and a bit of 'hand-holding' for what I need.
    I run SBS 2011, and in Group Policy Management I have a custom GPO.  In this GPO I define all my settings.  I understand this may not be the best or most practical method of applying policies, but I am not very strict and have few settings.  This
    policy existed prior to my joining the company, and was migrated in to this SBS '11 from SBS '03.  That may be the issue, but before making any changes I am seeking expert advice.
    When I select that GPO, named "Main GPO", and click on the tab at the top "Settings" I see the error: "An error occurred while generating report: Object reference not set to an instance of an object."
    I saw that when I right click the GPO > View > Options and select the tab "Reporting" that it states that for reporting to work the location of the .adm files must be specified.  I see that my option for the location is set to "Default"
    which by my guessing would be located in the C:\Windows\sysvol directory.  Below is what I see there:
    C:\Windows\sysvol\domain
    C:\Windows\sysvol\staging
    C:\Windows\sysvol\staging areas
    C:\Windows\sysvol\sysvol
    I think the problem is that my custom GPO are not inside the default location, which I speculate is: C:\Windows\sysvol\domain\policies (which I do see some objects there).
    But instead I also see items in this folder: C:\Windows\sysvol\sysvol\JOHN.LOCAL\policies (while where I just typed 'JOHN.LOCAL' is my actual local domain).
    To further this, when I edit that custom GPO, then at the very top of the tree I right click on it and select Properties, I see a Unique Name listed there as a long string of numbers and letters, similar to a registry entry.  I searched my server for
    that same Unique Name and found it listed inside the folder: C:\Windows\sysvol\domain\policies
    If I am correct with my assumption and basic knowledge, I should move all objects as follows:
    -Move FROM: C:\Windows\sysvol\domain\policies
    -Move TO: C:\Windows\sysvol\sysvol\JOHN.LOCAL\policies
    My concerns are that I am not correct at all, that I will break something, that there may be an easier fix than moving anything, or that I am overlooking something causing this error altogether. 
    Thank you for anyone's help and time with assisting me with this request.
    John Fester

    > top "Settings" I see the error: "An error occurred while generating
    > report: Object reference not set to an instance of an object."
    That's due to a security setting (most possibly) your current OS does
    not understand. Hard to find out wich exact setting it is... To resolve
    this issue, we need the gtpptmpl.inf file residing in the policiy's
    sysvol folder. To open this folder, edit the policy, move to computer
    settings - policies - windows settings - scripts - startup, press "show
    files". Then move two folders upwards and back down to
    .\microsoft\windows nt\secedit. There you'll see the gpttmpl.inf - post
    its contents and we'll have a look at it.
    > location, which I speculate is: C:\Windows\sysvol\domain\policies (which
    > folder: C:\Windows\sysvol\sysvol\JOHN.LOCAL\policies (while where I just
    That's perfectly ok - JOHN.LOCAL in fact is a symlink pointing to "domain".
    > all objects as follows:
    > -Move FROM: C:\Windows\sysvol\domain\policies
    > -Move TO: C:\Windows\sysvol\sysvol\JOHN.LOCAL\policies
    No.
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

  • File name field not generating dynamic file name for report printing

    Hello Folks,
    I have a report region on a page and have enabled report printing. I would like to have the file name generated dynamically. So, I add the substitution string, say "&P1_CUSTOMER_NAME." (no quotes). The output file I get is literally named "&P1_CUSTOMER_NAME..pdf" (no quotes).
    I have seen several posts suggesting the file name field should accept this syntax but, I cannot get it to work.
    We are running Application Express 3.2.0.00.27 and BI Publisher.
    Any suggestions?
    Thanks for your help.
    -Markus B.

    I was finally able to make it work using a page process and the APEX_UTIL.DOWNLOAD_PRINT_DOCUMENT with a submit button.
    -Markus B.

  • Generate dynamic hyperlinks in PDF

    Hi,
    I am using CF8. I want to generate dynamic hyperlinks for each Form field in a PDF template. Could you please suggest a solution to achieve this?
    Many Thanks.

    thread re-created! :(
    please see: Dynamic PDF Bookmarks/Hyperlink Generation in RTF template.
    Edited by: Mukunthan L on Jan 20, 2010 1:35 AM

  • Is it possible to use 3D objects in Flash CS4 for animation?

    Hi,
    Is it possible to use 3D objects created in 3D Max, Blendor, iClone etc. to perform animation to make Flash Movie more realistic? Can I make nice animations like in iClone 4 Software?
    If it is possible to use 3D Objects in Flash, please provide a sample Tutorial Link if you have any.
    Thanks in advance.

    Here are some links to 3d tutorils which u might find useful
    http://www.adobe.com/devnet/flash/3d_animation.html
    http://www.adobe.com/designcenter/flash/articles/lrvid4059_fl.html
    http://www.flashandmath.com/flashcs4/
    http://www.kirupa.com/developer/flashcs4/intro_3d_flashcs4_pg1.htm

Maybe you are looking for

  • Charging US Microphoto in the

    Hello all?I've got a MicroPhoto I bought in the US but I li've in the UK So far I've just ben charging it through my computer, but to charge it from the mains can I just use a UK charger, or do I need to use a US charger with a plug adapter, or do I

  • Report as batch process?

    Can we run a Z program or report as background process or batch process? if yes, how?

  • Display Manager fails to launch [SOLVED]

    Hello, TL:DR - KDM and other display managers fail to load after major system update, included Xorg.0.log and kdm.log for troubleshooting I've been using Arch since January 2015 and this is my first major breakage following a pacman -Syu on June 3rd.

  • SQL errors log

    Hello! Where can I find SQL expressions errors log used in custom applications? P.S. Oracle 9.2.0.1 Message was edited by: Oleg Derevyanko

  • Fuzzy colored g4 display

    I have a G4 and about 2 months ago had the video RAM replaced. It has been running fine until last week. Now the colors are all fuzzy and you can't read anything. I ran the hardware test & got error code 2ATI/5/4:113-xxxxxx-142. Now I just have a blu