Revealing sprites dynamically

Hi,
I've adapted the built-in behaviour 'Turn towards mouse' so
that a ruler appears on my stage when the 'r' key is down and the
user clicks and holds the mouse button down. It rotates around the
point at which it was placed, and follows the mouse as long as the
'r' key (and mouse button) is down. What I want to add to this
behaviour is revealing the ruler image dynamically as the pointer
drags away from the point of origin. In other words, the finished
effect will be to click anywhere on the stage and effectively
'draw' a ruler in the direction and to the length desired. Can
anyone point me in the right direction?
Many thanks,
TzK.

it works now. - thank you. oh man. lingo is soo
time-consuming if you don´t do it regularly... :(
but at least i´m able to be pleased with the little
successes....
that´s the code that worked for me, if someone else
should be searching for this:
vFolder = the moviePath --startupFolder
gFolderList = baFolderList(vFolder) -- list subfolders of
startupFolder
gFolderPosList = [point(100, 100),point(100, 200),
point(100, 300), point(100, 300), point(100, 300), point(100, 300)]
-- erase all fields on startUp to avoid thousands of fields
later.. ;)
repeat with vEraser = 1 to (the number of members of castlib
"internal")
if member(vEraser, castlib "internal").type = #field then
member(vEraser).erase()
end if
end repeat
repeat with vFolderName in gFolderList
vFieldMember = new(#field) -- create new field
vFieldMember.name = vFolderName & "member" -- give field
same name as the folder has
vString = ""
put RETURN & vFolderName after vString
delete char 1 of vString -- initial RETURN
vFieldMember.text = vString -- put name of the field/folder
into field
vSprite = new(#sprite) -- create new sprite (necessary for
displaying on stage)
sprite(vSprite).member = member(vFieldMember) -- fill
sprites with field-members
actPos = gFolderList.getPos(vFolderName) -- temp. shortening
of that listPos-thing
channel(actPos).makeScriptedSprite(member(vFolderName &
"member"), gFolderPosList.getAt(actPos))
end repeat

Similar Messages

  • Creating Sprite Dynamically

    I don't want to place sprites on stage at design time I want
    to create them dynamically say on mouseDown event; is this
    possible.
    Rite now what I am doing, deleting the object from stage and
    leaving the empty sprite on score window then my following script
    works but I want to create empty sprite on the fly.

    If you have a behaviour named "doSomething", and you want
    your sprite to
    be in channel 1 using a member named "button", you would add
    it like this:
    channel(1).makeScriptedSprite(member("button"))
    sprite(1).scriptInstanceList.append(script("doSomething"))

  • How do I convert a jpg to a Sprite

    Just want to turn a jpg into a Sprite dynamically.

    When you load an external jpg, your Loader.content is of type flash.display.Bitmap. I don't believe you can convert this Bitmap to a Sprite.
    Why do you need it to be a Sprite? Bitmap is a display object.
    If you definitely need a Sprite, all i can think of is to create a Sprite and add the Bitmap to your sprite using Sprite.addChild.

  • How do you dynamically find objects

    I'm creating sprites dynamically on a button event.  So for example there is a sprite with a name of "parent_X" where X is a sequential number starting at 1...  So in theory I may have parent_1, parent_2, parent_3, and so on depending on how many times you press this button.
    Each sprite has a textField child also with a dynamic name, like textChild_1, textChild_2, textChild_3 and so on.
    User can remove a parent and child from the stage... what I do is remove the sprite and then delete it ... so if the parent name is loaded into a string called "textParent" I do:
    var target:DisplayObject = getChildByName(textParent);
    removeChild(target);
    delete getChildByName(textParent);
    This seems to work.  Question 1: by deleting the parent are both objects destroyed?  What I mean is that if you simple removeChild(myChild) and later do addChild(myChild) the child is returned to the stage... so if delete the parent and later, I'm assuming the child and parent are gone for good unless they are re-established?  Is this correct thinking?
    Moving on, what I need to do is determine what parent(s) and child(s) are still accessible in code after some have been removed / deleted.
    Not sure if you understand what I mean, but at some point I need to know what "parent_X" and "child_X" items (objects?) exist? 
    I'm trying something like this:
    x = 1;
    var target:DisplayObject = new DisplayObject();
    while(x <= textAreas) {   // textAreas is the counter to assign next parent_X number it is an int
      var target:DisplayObject = getChildByName("parent_" + String(x));
      removeChild(target);
      x++;
    This fails, I think if a parent_X was removed (deleted) .. it seems to only remove the first target if more than one were previousy created and then destroyed.
    Am I going about this correctly?
    Thanks for any help.

    1.  target isn't destroyed with that code. it still exists and can be re-added to the display list at any time.  you should assign target to null when you want to ready target for gc.  when target is gc'd the child may or may not be gc'd depending on how it's created.  my guess is the child will not be gc'd.
    2.  use an array to store and track your existing parent objects.

  • New to .as files

    hello to all
    what i am trying to do is by pressing zero_btn which is an object in the library to print a number in the dynamic text box ( result_txt ) which is also an existing object in the library and on stage.
    my knowledge in actionscript is not much and messing with .as files is totally new to me!
    then thing is that this code when i locate into to .fla file works fine.
    there is no error with the code i posted, but am sure something is missing
    ... like calling the constructor of the .as file.
    In the library the name of it is Zero_btn and the instance name of this object is zero_btn and it is a button
    package
        import flash.events.MouseEvent;   
        import flash.display.Sprite;
        public class displayNumbers extends Sprite
            zero_btn:Button = new Zero_btn();
                zero_btn.addEventListener(MouseEvent.CLICK, callZero);
            public function callZero(e:MouseEvent):void
            trace("works");
            }//function callZero
        }//class displayNumbers
    }//package

    .as file :
    package
        import flash.events.MouseEvent;  
        import flash.display.Sprite;
        dynamic public class displayNumbers extends Sprite
            zero_btn:Button = new Zero_btn();
            addChild(zero_btn);
               public function displayNumbers ()
                zero_btn.addEventListener(MouseEvent.CLICK, callZero);
            public function callZero(e:MouseEvent):void
                trace("works");
            }//function callZero
        }//class displayNumbers
    }//package
    the action file:
    new displayNumbers();
    when i run it  the following errors appear:
    1120: Access of undefined property Button.
    1180: Call to a possibly undefined method Zero_btn.
    1180: Call to a possibly undefined method addChild.
    1120: Access of undefined property zero_btn.
    Warning: 1058: Migration issue: The property Button is no longer supported.  The Button class has been renamed SimpleButton..

  • Why can't the Accordian widget's drop down box span full width in mobile layout?

    I'm trying to create a simple drop down navigation for mobile. When the entire header is clicked, it expands down to reveal a dynamic vertical menu, which will cover the page content below, not push it down.
    I've taken an accordian widget and added a vertical navigation widget (to allow dynamic navigation) into the expanded area. When I preview it, the drop down box of the accordian widget doesn't span the full width of the site width (380px). It stops 5-10px short of the right edge, which is a small detail, but it annoys me, and is not how I have it set up in design view. There is no other content on the page, just this element. When I have elements extend off the page area, it somehow affects the amount of space the drop down area stops short from and adds more. Strange again. Kind of stumped as to if/how I can fix this.
    Screenshot attached.

    The code taht you have shown is not the template, it is a document that has been created from a template and renamed with a dwt extension.
    If you load the document into DW then go to menu item Modify->Templates->Detach from Template and save the file, you will have your original template called index.dwt and located in the Templates subdirectory.

  • Help needed when dynamically creating new stage sprites

    Morning folks,
    I'm feeling very rusty when asking this question! It feels
    like I should
    know the answer but simply unable to comprehend where I'm
    going wrong at the
    moment!!
    I'm in the process of creating a Director piece that involves
    the user
    having to drag "shapes" onto a pre-defined grid [drag and
    drop style] --
    there are currently three different types of shape that can
    be dragged of
    which many of the shapes can be of the same type. So I need
    to display the
    three shape types on one side of the screen and allow the
    user to drag and
    drop as many as they wish to the girded area.
    I've written the drag and drop routine but now having
    difficulty in
    producing the dynamic creation of a new draggable shape; so
    far I've managed
    to create a new "shape" sprite from my cast library and
    placed it in the
    correct location. Then I create and add a new instance of my
    "Drag and Drop"
    behaviour onto the newly created sprite, but this is where it
    goes wrong --
    although I can drag the dynamically created sprite, once
    dropped Director
    complains of not knowing what its local properties are, for
    example I'm
    unable to reference the locH and locV of the newly created
    sprite!
    I'm really at a loss on this one and would appreciate any
    kind of guidance!
    Many thanks in advance, Mark ;-)

    Hi Saravanan,
    >>>><b>First column - Welcome message , below Date , time and place</b>
       It is possible to add date, time and location in the welcome area. Jus add a table to the <td> of the welcome area container. Like this.
    <% Date d= new Date(); %>
    <TD nowrap class="prtlHdrWelcome" ti="0" tabIndex="0" id="welcome_message"><%=StringUtils.escapeToHTML(GetWelcomeMsg(componentRequest, welcomeClauseStr))%><table width="100"><tr><td nowrap><%=d%></td><td>INDIA</td></tr></table></TD>
    Hope it helps.
    Regards,
    Saravanan
    P.S: Hope you remember the thread
    <a href="http://">https://www.sdn.sap.com/irj/sdn/thread?threadID=152135&messageID=1703666</a>

  • Making dynamic sprites from a cast member

    Hello ,realy I am making a movie that it has the words and
    the meanings and the pronounciation and the image of the word of 20
    lessons ,realy I make a propertly list for the words and the
    meanings for each chapter in a text document for each lesson and
    retrievet the words and the meanings on the stage and assign the
    them into separate sprites made by a text cast member ,Now I have a
    problem ,the number of words and new words are not equal for each
    lesson ,there fore I look for a way to make the sprites same as the
    number of the words of each lesson from the cast member , is it
    realy possible ?
    Thank you very much
    Sincerely yours Mohsena

    Hello and thank you for your attention ,yes as you mentioned
    I should change the content of the text members ,in this way when I
    want tthe words and the meanig of lesson 2 ,I should change the
    content ,But my problem is in this phase exactly ,for example if
    the lesson 1 has 30 words and meaning and lesson 2 has 20 meaning
    ,one way is to predefined 30 sprites froem the cast memeber and use
    object oritented programming that make just 20 new object for
    lesson 1 (I can do it) but realy what is in mind is that ,is it
    possible to make the sprites as needed? for example for lesson 1
    make 30 sprites ,the somehow destroy them ,and for lessson 2 make
    20 sprites?
    thank you very much for your attention sincerely yours
    Mohsna

  • Creating crystal report file dynamically.

    Post Author: malcomstewart115
    CA Forum: General
    Hi, everybody.
    I have one problem.
    How to create crystal report file(*.rpt)  in php dynamically.
    I mean, I want to create the "*.rpt" file with php code.
    Please help me. thanks everybody.

    Post Author: PWilkens
    CA Forum: General
    It sounds like you're defeating the power and purpose of Crystal Reports, or replace it with pure PHP (which I suppose could be done... but why?)
    What exactly are you trying to do?
    If you're trying to make certain parts of the report hide or reveal or change depending on variables settings in the PHP file, that's easy enough to accomplish by sending parameters with your PHP values into the report.  But the dynamic actions really need to be done within the report itself, accomplished through ample use of the section and field settings provided within the Report Designer.

  • How do I show multiple rollover images on a page inserted dynamically (pulled out of a sql database

    How do I show multiple rollover images on a page inserted dynamically (pulled out of a sql database table) using Dreamweaver’s Repeat Region. Example: I have different products each one associated (through their productID) with two images (one that’s showing in the page and one for the rollover effect) that are pulled from a database using Dreamweaver’s Recordset. So I want to end up with a page containing row after row of images(one for every product).When moused over each image will reveal the second (rollover) image for the same product which in turn can be a link(the image itself ) that when clicked leads to a detailed page with more information about the product the image is associated with. To show row after row with images for the different products in the database table I am using Dreamweaver’s Insert Rollover Image command and then the  Repeat Region – I have no problem to complete the steps, to insert the image and the rollover one at once and set the paths so they are pulled dynamically depending on the productID they are associated with .I have also no problem to apply the Repeat Region so not only the first image associated with the first product in the table is shown but all of them-a routine and standard procedure when using the Repeat Region to dynamically generate and display multiple rows of data. However, when I preview the page the rollover effect is lost –the images are shown but when moused over the second  image does not  show. The problem is caused when the Repeat Region is applied-once again I am allowed to apply it but the rollover stops working, a kind of interference. ANY SOLLUTION PLEASE, ANY WORK AROUND.

    I gotta tell you, using multiple images for rollover effects is going to be a big challenge in your dynamic scenario. 
    If this were my product page, I would use thumbnails with a bit of CSS opacity or filters to desaturate and make them full opacity/color on mouse over.  Nice effect with much less bandwidth. Easily done globally with CSS code.
    Two examples:
    http://alt-web.com/GALLERY/GalleryTest.php
    http://alt-web.com/TEMPLATES/CSS-Semi-liq-photo-sheet.shtml
    Nancy O.

  • How can I implement a dynamic loop rate?

    Appologies if this has been answered, but searching hasn't revealed the solution.
    I have a data acquisition appliction on the RT clocked externally.  I can send every x-th sample to the host PC for display via shared variable (data bandwidth is no issue).  I'd like to dynamically determine what "x" should be based on the processor load on the host (I can send x to the RT from the host).
    Is there a simple way to determine how much processor time my application is sucking up in the host PC application so I can adapt x to the environment?

    Hi Lee Jay!
    Thank you for contacting National Instruments.  From my understanding of the information you have provided, I think I may have a suggestion to achieve this behavior.  However, I am a bit unclear of what you are trying to do specifically.  LabVIEW does not have any inherent functionality to determine processor timing and resource usage as you have described.  From within the program we can determine the time that elapses from one point to another by using the Tick Count and Sequence Structures functionalities.
    Another aspect to consider is trying to use something similar to Queue Basics, which can be found in the Example Finder.  This should allow for control over the rate at which items are read at the host regardless of the data coming from the target.
    I hope this helps.  Let me know if there is anything else I can help with or clarify.  Have a great day!
    Jason W.
    National Instruments
    Applications Engineer

  • Positioning TextFields in Sprites?

    Hello
    First i will explain what i want to do,then explain the problem i am having.
    I am trying to create my own dynamic select list,that does more than the built in Flash components.
    all my list info is pulled from my database, and returned to flash swf using AMF services as a Object
    I want my list it to include face images at 50px by 50px and the persons full name  and other useful bits of information i can fit in each list item, which make scrolling a large list of people more manageable more interesting and less of a chore, than just scrolling a list of names in plain text.
    Problem
    only the first top item is positioned the way i want, the rest of the textfields are off or out side there parent objects, how do i force them all to stay in there parent objects? any help would be great...
    Example : i have a screen shot and code of the problem.
    public function setList(userlist:Object):void
                                  var images:Array = new Array("http://localhost/faceIcon2/img1.jpg",
                                                                                                         "http://localhost/faceIcon2/img2.jpg",
                                                                                                         "http://localhost/faceIcon2/img3.jpg",
                                                                                                         "http://localhost/faceIcon2/img4.jpg",
                                                                                                         "http://localhost/faceIcon2/img5.jpg",
                                                                                                         "http://localhost/faceIcon2/img6.jpg",
                                                                                                         "http://localhost/faceIcon2/img7.jpg");
                                  var personNames:Array = new Array("Henry William",
                                                                                                                    "Ava Sambora",
                                                                                                                    "Amy Lou",
                                                                                                                    "Freddie Benson",
                                                                                                                    "Richard Schiff",
                                                                                                                    "Laurence Fishburne",
                                                                                                                    "Joseph Cranford");
                                  var countY = setTextFieldYPos(images.length);
                                  for(var i:Number=0; i < images.length; i++)
                                            /* Set sprite and image elements */
                                            var listItems:Sprite = new Sprite();
                                            listItems.graphics.lineStyle(1,textColorRGB.grey);
                                            listItems.graphics.drawRect(0,0,600,50);
                                            listItems.name = "item_" + i;
                                            listItems.y = i*50;
                                            addChild(listItems);
                                            var urls:URLRequest = new URLRequest(images[i]);
                                            var imgLoader:Loader = new Loader();
                                            imgLoader.load(urls);
                                            listItems.addChild(imgLoader);
                                            /* Set username text fields */
                                            var myFormat:TextFormat = new TextFormat();
                                            myFormat.font = robotoLight.fontName;
                                            myFormat.size = 14;
                                            myFormat.color = textColorRGB.grey;
                                            myFormat.blockIndent = 55;
                                            var myTextField:TextField = new TextField();
                                            listItems.addChild(myTextField);
                                            myTextField.autoSize = TextFieldAutoSize.LEFT;
                                            myTextField.y = countY[i];
                                            //myTextField.height = 50;
                                            myTextField.border = true;
                                            //myTextField.background = true;
                                            //myTextField.backgroundColor = 0xeeaaaa;
                                            myTextField.defaultTextFormat = myFormat;
                                            myTextField.embedFonts = true;
                                            myTextField.antiAliasType = AntiAliasType.ADVANCED;
                                            //myTextField.text = userlist[i]["name"];
                                            myTextField.text = personNames[i];
    public function setTextFieldYPos(thisLength:int):Array
    var res:int = 0;
    var counts:Array = new Array();
    for(var i:int=0; i < thisLength; i++)
    res +=15;
    counts.push(res);
    return counts;

    again, use:
       var myTextField:TextField = new TextField();
                                            listItems.addChild(myTextField);
                                            myTextField.autoSize = TextFieldAutoSize.LEFT;
                                            //myTextField.height = 50;
                                            myTextField.border = true;
                                            //myTextField.background = true;
                                            //myTextField.backgroundColor = 0xeeaaaa;
                                            myTextField.defaultTextFormat = myFormat;
                                            myTextField.embedFonts = true;
                                            myTextField.antiAliasType = AntiAliasType.ADVANCED;
                                            //myTextField.text = userlist[i]["name"];
                                            myTextField.text = personNames[i];
       myTextField.y =50-myTextField.height;
    mTextField.x=50;

  • Setting dynamic widths for textfields in as3?

    I have 3 textfields. they're in a sprite container. 1. date 2. pipe_mc movieclip 3. title field. I need to set it so that the textfield/mc/textfield;s x property changes dynamically when a shorter or longer date gets added into the field, via XML.
    Here is the code:
    addChild(dateline);
    dateline.addChild(date_txt);
    dateline.addChild(title_txt);
    dateline.addChild(pipe_mc);
    date_txt.x = 3;
    var spacer:Number = 10;
    if (date_txt.textWidth >= 90) {
    pipe_mc.x = date_txt.x + date_txt.width + 18;
    title_txt.x = pipe_mc.x + pipe_mc.width + spacer;
    else if (date_txt.textWidth <= 90) {
    pipe_mc.x = date_txt.x + date_txt.width - 18;
    title_txt.x = pipe_mc.x + pipe_mc.width + spacer;
    pipe_mc.visible = true;
    Any help or suggestions are welcome
    Thanks

    Do you have the textfield set up to be autoSized?  Is there a reason for having three textfields separate rather than combining the text into one textfield with sufficient spacing between the entries?

  • Print Specific Frames and Dynamic XML content

    Hello, I am trying to print specific frames of my Flash movie
    with the dynamic text loaded from an XML file. The code below only
    prints the current frame I am on and does not print the XML text.
    The dataOK that is commented out is a function I have before that
    loads the XML content. The XML content is loaded to dynamic text
    boxes. Any help on this would be greatly appreciated.

    I am still having difficulty loading the XML data and the
    frameNum parameter does not seem to work. Argghhhh....
    function printTut(myevent:MouseEvent):void{
    var myPrintJob:PrintJob = new PrintJob();
    var mySprite:Sprite = new Sprite();
    var printArea:Rectangle = null;
    var options:PrintJobOptions = null;
    var frameNum:int = 2;
    mySprite.addChild(stage);
    mySprite.rotation=90;
    mySprite.scaleY=.80;
    mySprite.scaleX=.80;
    myPrintJob.start();
    myPrintJob.addPage(mySprite,printArea,options,frameNum);
    myPrintJob.send();
    print_btn.addEventListener(MouseEvent.CLICK,printTut);

  • AS3 - dynamic class names with *new* operator

    I'm using AcrtionScript 3 and Adobe Flash 9 Public Alpha.
    I have 50 movie clips in the Library that use Linkage to set
    the Class name to: Img1, Img2, Img3, ..., Img50.
    I have a parent class named RandImg. I want the constructor
    for RandImg to randomly select one of the 50 movie clips from the
    Library and display it. I could get this working by generating a
    random number, and then writing a really huge switch statement to
    associate each possible random number with its respective Library
    Movie Clip Class name, but I would much rather do this with a
    dynamic/variable class name based on the random number, such as:
    var nImgChoice:Number = Math.floor( Math.random( ) * 50 ) +
    1;
    var mcImg:MovieClip = new [ "Img"+String(nImgChoice) ] ( );
    addChild( mcImg );
    Note that this used to be possible in AS 2 by doing the
    following:
    this.attachMovie( "Img"+String(nImgChoice) , "mcImg",
    this.getNextHighestDepth());
    Suggestions?
    Thanks,
    ~JC

    import flash.display.DisplayObject;
    import flash.display.Sprite;
    import flash.utils.getDefinitionByName;
    var nImgChoice:Number = Math.floor( Math.random( ) * 50 ) +
    1;
    var ClassReference:Class =
    getDefinitionByName("Img"+String(nImgChoice) ) as
    Class;
    var instance:Object = new ClassReference();
    addChild(DisplayObject(instance));

Maybe you are looking for

  • In browser editing not working on some sites

    Hi. A client of mine wants to use in browser editing for a site I created in Muse CC 2014 so I tried to test it out.  I log in successfully to In Browser Editing but nothing on the site is editable.  When I log in to my own site through in browser ed

  • Multiple STATEMENT nodes in target structure for JDBC adapter

    Hi All, I have a file to JDBC scenario . At the receiver side we need to update two tables simultaneously . So in the target structure for JDBC , is it possible to have two STATEMENT nodes , so that 2 tables can be updated simultaneously. Please help

  • How to use an Oracle sequence with BC4J ?

    I'm using Business Components for Java (BC4J) with JDeveloper 3.0. In my database I need to insert a unique ID for each record inserted (a user ID). I know Oracle can generate automatically this munbers, using a sequence. How can I insert it automati

  • Missing DLLs After Updating SB Live! Dri

    A few days ago I updated my Creative SB Li've! driver to the latest available on the Creative site. Since then I've been getting messages about two missing DLLs: Ctkbres.DLL and CtSuRes.DLL. I really don't want to roll back my system, as I've done a

  • Cancel Workflow Button - Custom OA Page

    Hi, I tried searching for this, but didn't find anything. Is it possible to implement Cancel workflow process Button in Custom OA Page? If yes, some help would be much appreciated Thanks Ved.