Scripting MovieClips at runtime

It's it possible to create an empty clip and then add frames,
frame labels and scripting to it at runtime?

add frames and frame labels, i'm not sure... but scripting is
possible and drawing the first frame
here's an example (in code).
It creates a movieclip with a name called blahblah and random
numbers after it. Since we don't know what the number is, (and
usually when you create a movieclip that's the case) we represent
the newly made item with the variable blah.
Then it draws a 10x10 box (with 0,0 as the center). It moves
it to the center of the screen (for the heck of it).
Then the onEnterFrame = function() is how you script with it.
Saying "with" makes it use the local variables as blah. In
blah, it makes the _x and _y to the mouse.
Hope this helps.

Similar Messages

  • What's the code for Scaling a MovieClip at Runtime?

    I can't believe how difficult it's been to find an answer for such a simple question.  I found a thread in this forum titled "How to Resize a MovieClip at Runtime?", but the code that was posted as an answer has been removed from the post.  WHY?!?!  Is it a highly guarded secret?!?!
    Anyway...I just want to know how to scale a movieclip at runtime with a drag function...and also while the parent movieclip already has a drag function active.
    Any help would be much appreciated.
    BTW...I've found a cure for death that also instantly makes you the richest person in the world with all the knowlege of the universe...
    It can be found here:

    onMouseUp and onRelease is usually (but not always) the same.
    you can use a scaling factor:
    var scaleFactor:Number = .3;
    mc.onPress=function(){
    resize_mc = this;
    startX =_xmouse;
    startY = _ymouse;
    this.onEnterFrame=resizeF;
    mc.onRelease=function(){
    delete this.onEnterFrame;
    function resizeF():Void{
    resize_mc._width+=(_xmouse-startX)*scaleFactor;
    resize_mc._height+=(_ymouse-startY)*scaleFactor;

  • Nesting dynamically created movieclip at runtime?

    Is it possible to nest a movieclip into another dynamically
    created movieclip at runtime? The commented line of code works, but
    I am trying to nest a movieclip after it is created into
    another.

    you can nest movieclips by using your commented code.
    however, you cannot change a movieclip's parentage after it's
    created.
    you can "fake" a parentage change by creating a movieclip
    with the parentage you want, copying its assets to the newly
    created movieclip with the desired parentage and finally removing
    the original movieclip.

  • SUPM 2. 0 - Automated script management - Portal runtime error

    Hi,
    Whenever I click on "Automated Script Management" I receive this message:
    Portal runtime error.
    An exception occurred while processing your request. Send the exception ID to your portal administrator.
    Exception ID: 11:14_15/06/11_0008_11133350
    Refer to the log file for details about this exception.
    When I look at the log history, I see 1 error: "No hierarchy maintained for object type".
    What do I have to do to resolve the issue?
    Thanks,
    François

    Hi..
    Since you are getting an error of Hierarchy, you have to follow the following steps:
    1. After specifying the Hierarchy name in SPRO, Login to SuPM and go to "Settings" tab and select the tab "Default Hierarchy"
    2. Here, you have to select the Hierarchy which you want it to be used by SuPM application
    3. Then, you have to go to "Application Properties" and select "Data Source Administration"
    4. You have to Refresh All the Data Sources to reflect the changes.
    Now, Try using the application, it will not throw you any error.
    Hope it helps,
    Regards,
    Raghunandan GV

  • Class Inside MovieClip Giving Runtime Error

    Hey guys.
    I'm trying to place an instance of a movieclip (instance
    name: tehMovieClip) from the library within another movieclip
    (instance name: parentMovieClip) on the stage. tehMovieClip, the
    movieclip going inside another movieclip, belongs to a class called
    CollisonDetection (linkage properties, class:CollisonDetection,
    Base Class: flash.display.MovieClip). When I put tehMovieClip
    inside parentMovieClip, I get this runtime error:
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    If I just place tehMovieClip on the stage by itself, it works
    fine but I need it to be inside parentMovieClip. So what should I
    do?
    Just for your information, CollisonDetection extends the
    project's DocumentClass which extends MovieClip.
    Thanks in advanced!

    Thanks for that buddy.
    quote:
    Originally posted by:
    SwapnilVJ
    Is the movie clip your are placing linked from library to a
    class?
    The movieclip in question (the one I am placing inside
    another movieclip) is linked to a class.
    quote:
    Originally posted by:
    SwapnilVJ
    If yes. Is the Class linked to the movieclip have a
    Constructor method with parameters?
    Well this is my current constructor:
    public function CollisonDetection() {
    playerRefFromCollisonDetection.x = 600;
    Now that you've said that, I deleted that middle line and it
    seemed to work
    quote:
    Originally posted by:
    SwapnilVJ
    If Yes. you found the problem.
    And solution will be to update the class' constructor to have
    no parameters.
    Thanks buddy, but what if I need to have statements inside
    the constructor such as triggering methods/functions inside the
    class?

  • "selecting" a movieclip at runtime

    I've got a number of movieclips on the stage and I have a
    slider which I want users to use to change the height and width of
    these movieclips. But how do users "select" a movieclip and then
    how does the slider know which has been selected so it can adjust
    the size of the selected movieclip. Finally, how do users select
    another movieclip if they wish to resize that one?
    Thanks!
    Michael

    Several solutions but try using this one:
    set a timeline var like 'current_mc'.
    In an onRelease event for the mc's the user select, set that
    timeline var to 'this' which creates a reference to the clicked mc.
    Your function that scales the mc should then use current_mc
    to do the scaling on.
    var current_mc:MovieClip;
    mc1.onRelease=function():Void{
    current_mc=this;
    }

  • Resize a movieclip at runtime

    I'd like users to be able to drag out a shape from the side
    of the stage (say a square) and then resize it on the stage. I
    think I've seen this Flash functionality somewhere on the web, but
    I can't figure out what the code would be for this. Can anyone
    help?
    Thanks,
    Michael;

    I think I've got the problem solved, but can I follow up on
    one thing you mention below? It has to do with the parent/child
    relationship and the startDrag action. I was under the impression
    that if I put a movieclip inside of another movieclip and then
    apply a drag action to the parent movieclip, then there was no way
    to access the child movieclip. For example, I put a small textInput
    component inside of a larger movieclip and then I put a drag action
    on the movieclip. I wanted users to be able to type in some text
    into the middle of the movieclip and then move the moviecip around
    if they wanted to. However, as soon as I put the drag action on my
    parent movieclip, the inputText component could no longer be used -
    the "hand" appeared over whole movieclip so users could no longer
    type anything into the inputText area. Is there any way to do what
    I want to do here?
    Appreciate your help!
    Michael

  • Parameter  to shell script using Runtime.exec(string)

    Hi all, ( Speciall hi to dheeraj tak )
    Briefly : How do i pass an arguement to a non - java executible being called using Runtime.exec.
    In detail : i am using Runtime.exec to call a shell script : The code is as follows:
    String callAndArgs[] = {"/home/tom/jakarta-tomcat-4.1.24/webapps/dash/script.sh"};
    try {
    Runtime rt = Runtime.getRuntime();
    Process child = rt.exec(callAndArgs);
    This works properly & calls the shell script which in turn invokes some other executible (c file).
    $HOME/midi/test/build/bin/<C-EXECUTIBLE>
    Here i am specifying the name (say hello.exe ) . So far so good.
    I want to make this happen dynamiclaly. so i need to pass the name of the executible as a parameter to the script.
    To pass a parameter i hav to change the string to :-
    String callAndArgs[] = {"/home/tom/jakarta-tomcat-4.1.24/webapps/dash/script.sh <C-EXECUTIBLE HERE>"};
    and the script to
    $HOME/midi/test/build/bin/$1 --- where $1 refers to argument 1. (C-EXECUTIBLE AGAIN).
    This is giving an IO - Execption. Plz help
    Code will be very helpful.
    Thanx in advance

    some 1 plz tell me the difference :-
    This is the documentation of Runtime.exec that i found :-
    1> exec
    public Process exec(String command) throws IOException
    Executes the specified string command in a separate process.
    The command argument is parsed into tokens and then executed as a command in a separate process. This method has exactly the same effect as exec(command, null).
    Parameters:
    command - a specified system command
    Complete refernce says : Process (String progName) ----- Executes a program specified by programname as a seperate process.
    2> exec
    public Process exec(String cmdarray[]) throws IOException
    Executes the specified command and arguments in a separate process.
    The command specified by the tokens in cmdarray is executed as a command in a separate process. This has exactly the same effect as exec(cmdarray, null).
    Parameters:
    cmdarray - array containing the command to call and its arguments.
    Complete reference says : Process exec(String comLineArray[]) ---- Executes the command line specified bythe string in comLineArray as a seperate process.
    This means that there is provision 4 command line arguments...
    how do u use it then????????????????????????????

  • Checking output of script line by line at runtime

    hi,
    I am new in solaris scripting. I want to ask that is there any way to check the output of the solaris bash script line by line during runtime of script execuation.
    I actually want to check the values during script execuation at runtime.
    Thanks

    (k)sh -x <scriptname> will show you line by line output.

  • ComboBox problems when in a MovieClip loaded at runtime

    Hello,
    I hope someone out there can help me with this problem: I
    have a ScrollPane that contains a MovieClip that to which I attach
    several other MovieClips at runtime in response to user inputs
    using attachMoveClip() (both MCs are in my library and set to
    export for actionscrip in first frame). Each of those MovieClips
    contains a ComboBox.
    At runtime, I attach the MovieClip containing the ComboBox,
    then I set the dataProvider property for the ComboBox to a list
    (Array) of data/label value pairs. I then try to set the text
    property of the ComboBox to a "Please select a value" message and
    then I add a couple of listeners.
    Setting the dataProvider property sort of works: the ComboBox
    displays the proper dropdown list when clicked, but nothing happens
    when I select an item from the dropdown list - i.e., the selected
    value doesn't display in the ComboBox's TextField.
    Setting the text property doesn't seem to work: the value
    doesn't display in the ComboBox's TextField, but oddly, if I trace
    the ComboBox's text property, it outputs the correct message.
    Also, none of the event handlers work at all.
    I tried all of the same code on a ComboBox that isn't created
    dynamically, and it all works.
    Here's the code. The first set of code is the part I need to
    get working. It sets up the ComboBox after the MovieClip it is
    contained in is attached to the parent MovieClip. The second set of
    code was my test code to see if this worked on a ComboBox that
    isn't created at runtime. It all works properly.

    Most likely the Combobox isn't fully loaded yet. In your code
    check if a property of the cb is undefined using an interval and
    proceed with the code when the property is defined.

  • Controlling an instantiated MovieClip's animation from it's Class

    Hi all
    Say if I have a MovieClip, that gets instantiated on a Class like this:
    var myMC:MyMC = new MyMC();
    addChild(myMC);
    And that MovieClip has a class that looks something like this:
    package{
      import flash.display.MovieClip;
      public class MyMC extends MovieClip{
        public function MyMC(){
          stop();
    This myMC is an animation, which has a series of Labels in the timeline. However, there aren't any actions in the timeline, because in MovieClips that have custom classes that get added to the stage, I find that the actions in the timeline get ignored.
    So if I want to play the animation for a sequence, and stop it when it reaches a label, the only way I've ever got this to work is to add a bunch of listeners to the MovieClip's class, like this:
    public function playAnimation():void{
      gotoAndPlay("animateIn");
      addEventListener(Event.ENTER_FRAME, animateInHandler);
    private function animateInHandler(e:Event):void{
      if(currentLabel=="stopAnimateIn"){
        stop();
      removeEventListener(Event.ENTER_FRAME, animateInHandler);
    This seems like a giant pain to do, especially when you start talking about more than 10 animation sequences in 1 MovieClip, and dozens of hese MovieClips on screen.
    Is there an easier way to do this? Any help is always appreciated.
    Thanks
    Chris

    I find that stop scripts in a movieclip work fine. I literally copied and pasted your scripts into a test movie/AS file, and put in a tween in the movieclip in the library, and could play from anywhere, and teh stop action would stop it from continuing.
    If that doesn't work out for you, you might search for addFrameScript in Google. With that you can add a frame script to a movieclip at runtime.

  • Running Shell script from command line

    Hi,
    I am getting a Exception in thread "main" java.lang.NoClassDefFoundError: TestRuntime/java error when I run the following code on my linnux box...can anyone please help
    import java.io.*;
    public class TestRuntime {
            public static void main(String args[]) {
                    Runtime runtime = Runtime.getRuntime(); //get runtime information
            try {
                            Process Child = runtime.exec("/usr/bin/ksh"); // execute command
                            BufferedWriter outCommand = new BufferedWriter(new OutputStreamWriter(Child.getOutputStream()));
                            outCommand.write("/home/mypath/tesh.csh");
                            outCommand.flush();
                            try {
                                    Child.waitFor(); // wait for command to complete
                            } catch (InterruptedException e) { // handle waitFor failure
                                    System.out.println("ERROR: waitFor failure");
                                    System.exit(10); // exit application with exit code 10
                    } catch (IOException e) { // handle exec failure
                            System.out.println("ERROR: exec failure" + e);
                            System.exit(11); // exit application with exit code 11
    }

    If I'm reading your code correctly, you're starting a Korn shell session, then executing your C shell script as if you were at at the session window's prompt. If that is correct, you haven't caused your standard out (stdout) to hit ENTER yet. I'm not an expert, but I hope this works for you.
    Your code:
    Process Child = runtime.exec("/usr/bin/ksh"); // execute command
                            BufferedWriter outCommand = new BufferedWriter(new OutputStreamWriter(Child.getOutputStream()));
                            outCommand.write("/home/mypath/tesh.csh");
                            outCommand.flush();I think you need to enter one extra line before the flush():
    Process Child = runtime.exec("/usr/bin/ksh"); // execute command
                            BufferedWriter outCommand = new BufferedWriter(new OutputStreamWriter(Child.getOutputStream()));
                            outCommand.write("/home/mypath/tesh.csh");
                            outCommand.newLine();  // hit ENTER
                            outCommand.flush();P.S. If you're running this script and your Java program from the same UNIX machine, you could just execute the shell script inside the runtime.exec() call.

  • Deploying an Application to a APEX 3.1.1 Runtime Environment

    Hello Everyone,
    I'm trying to work out how to deploy an application from a development to runtime environment but am facing a few issues / uncertainty and would appreciate any input/help on this. To begin with here is my environment:
    - Apex 3.1.1
    - Two Oracle 9i (9.2.0.8) instances running on different hosts (development environment on host AA and runtime environment on host BB)
    - Using the Oracle 9i HTTP Server with mod_plsql (on both hosts)
    - DEVLWS workspace +(on development env)+
    - DEVSCHEMA schema +(on development env)+
    - USER01 - non-developer & non-admin user +(on development env)+
    - DEV01 - developer and admin user +(on development env)+
    I'm performing this test deployment with the downloaded application Timesheets from apex.oracle.com with the application ID of 111 (when imported into my development environment).
    Situation:_
    I have no issues on the development environment. I can import the Timesheet app into it and run it using either the USER01 or DEV01 ID as it was imported into the DEVSCHEMA schema. However, when I try to deploy over to my runtime environment, here is where things gets sketchy on this.
    1) In order to get this application (Timesheets) to run properly on my runtime environment, I've to perform a Oracle9i EXP of my DEVSCHEMA objects and import this into my runtime environment using the IMP utility to get the proper workspace and associated objects over,
    --> I tried exporting the workspace on the development env but even after running it on the runtime env, I was not able to get the application to run (missing workspace schema, users etc).
    2) From my development environment, I export the Timesheet app with supporting objects option and on the runtime environment, I use SQL*Plus as such:
    SQL> alter session set current_schema=FLOWS_030100;
    SQL> @f111.sql
    Once the script completes, I use the http://hostBB:7776/pls/apex/f?p=111.1 url and was able to get in to the application, however I found things like the images are missing and I've to manually export these again from the development env and run the generated SQL script file on my runtime env.
    Is there a better (and documented step by step) way of doing this kind of deployment? The Apex User Guides talks about creating a packaged application but I didn't see this as a way to deploy specifically into a runtime environment as I followed it and still had missing images. When I did the export of the Timesheet application, I used the DEV01 id and made sure I selected the 'with supporting objects' option but yet I've to do most of the steps manually (i.e. build the schema, tablespace, application tables via exp/imp) and again the images were not included.
    Is there a document / note available that discusses this in better detail (deploy from Development env to Runtime env) so that I can do cut down the manual steps and making sure that my developers can effectively deploy our apps with minimal fuss and headaches? Appreciate any input.

    ...I've to perform a Oracle9i EXP of my DEVSCHEMA objects and import this into my runtime environment using the IMP utility to get the proper workspace and associated objects over,...
    EXP/IMP will not do workspaces. You can use the Application Express apex_admin application to export a workspace to a file. Then, in a runtime environment, you can install that workspace file using SQL*Plus. This way of
    creating the workspace also ensures that it will have the same workspace ID as it did in the original database, making possible the installation of exported applications from application export files from the original
    workspace into the new workspace having the same workspace ID and also where the installed applications are to have their original application IDs.
    ... and still had missing images. When I did the export of the Timesheet application, I used the DEV01 id and made sure I selected the 'with supporting objects' option but yet I've to do most of the steps manually (i.e. build the schema, tablespace, application tables via exp/imp) and again the images were not included.
    Images aren't part of application exports. Exporting the images to a file and then installing them using that file and SQL*Plus is the way to do it.
    As Patrick mentioned, running the application export file in SQL*Plus doesn't run the supporting objects script. It creates the script in the datbase. But in a runtime environment you can't run the script because the runtime environment lacks the Application Builder.
    SQL> alter session set current_schema=FLOWS_030100;
    SQL> @f111.sql
    You can install applications by connecting as a less privileged schema. Any schema assigned to the workspace into which the application is to be installed will do. To install workspace export files (or applications), you can also use a schema that has been granted the role APEX_ADMINISTRATOR_ROLE.
    Scott

  • I have a visual C    runtime error stopping my pse elements 10 running in win 8.1. I am not a techie so am looking for a very clear way to resolve teh issue without needing too much technical ability. Can anyone help?

    I had been using my elements 10 for much of the day so do not know what I have done to upset it! I was starting up again and it began to load then offered me this line of script re a 'runtime error'. That means nothing to me except that it no longer works. I have had a peek on Google and see various suggested fixes from sources I don't know whether to trust. Also some fixes give a list of do's that to a non techie like me are not followable. Can anyone offer me some understandable guidance so I can get back to playing with my photos?

    You'll need to ask in the Photoshop Elements forum whose members can better answer this.
    Photoshop Elements
    Also keep a brief summary in the subject line and use the main posting window to describe your issue in detail.
    Subject: Visual C runtime error    as an example.

  • Scheduling an Apple Script [eyeTV DVB Update] more...

    Like many other eyeTV Users, I have opted out of the iceTV [Australia] annual subscription, and am using the DVB Program Guide.
    But eyeTV does not support scheduled updates of the DVB Guide, only subscription services [annoying].
    Recently ctzsnooze proposed an Apple Script which if run periodically would update of the eyeTV DVB Program Guide.
    https://discussions.apple.com/thread/6043805
    And a few years ago Camelot proposed a means to schedule a script to run periodically.
    https://discussions.apple.com/thread/673340
    After a little testing, I believe I have refined this script to properly run to a regular schedule.
    Here is a copy of my updated version of Camelot's test routine: Note the following...
    a) the initial date must be set in the future, otherwise the idle loop will run every five seconds [idle return is negative].
    b) use >=, not simply > in the idle loop, otherwise the scheduled run time becomes offset [+5 * minutes in this example].
    c) I found the display notification a really neat way to log progress of the script while testing, and have now incorporated a Notification into my file Script for the eyeTV Program Schedule Update, to confirm it has run once a day, or hour.
    d) Compile then Save As, Application, and Stay open after run handler.  The first time you run it, you will need to authorise it...
    property runTime : missing value
    on run
              set runTime to date "Wednesday, 07 May 2014 13:45:00"
              display notification "Update Script initialised at: " & runTime
              display notification "Time now is: " & (current date)
    end run
    on idle
              if (get current date) ≥ runTime then
                        display notification "Update Script ran at: " & (current date)
                        set runTime to runTime + 5 * minutes
                        display notification "Next execution of Update Script will be at: " & runTime
              end if
              display notification "Script Return Value is: " & (runTime - (get current date))
              return (runTime - (get current date))
    end idle
    Here is an example run...
    And here is my update to Ctzsnooxe's version of the eyeTV DVB Program Guide auto update script, and a copy of the resulting Notifications...
    Delete the display notifications you do not wish to see from the script, once you prove the script.
    property runTime : missing value
    on run
              set runTime to date "Wednesday, 07 May 2014 15:00:00"
              display notification "eyeTV Programs Update Script initialised at: " & runTime
      display notification "Time now is: " & (current date)
    end run
    on idle
              if (get current date) ≥ runTime then
        display notification "eyeTV Programs Updated at: " & runTime
        tell application "EyeTV"
            activate
        end tell
        tell application "System Events"
          tell process "EyeTV"
            keystroke "g" using command down
            delay 1
            click (pop up button 1 of window 1)
            delay 1
            click menu item "Update DVB Program Guide" of menu 1 of pop up button 1 of window "EyeTV Programs"
          end tell
        end tell
        set runTime to runTime + 1 * days
        display notification "Next Update of eyeTV Programs will be at: " & runTime
              end if
              display notification "Script Return Value is: " & (runTime - (get current date))
              return (runTime - (get current date))
    end idle

    Stephen,
    I ran into some scheduling issues after Wake from Sleep, and after some fiddling around, made the following changes.
    This version is set up to run every hour [so I could test error handling, window, wake, and sleep issues]
    -- eyeTVAutoUpdate (Hour) Script:
    -- [for testing, setup to run every hour...]
    -- When proper operation is confirmed,
    --       Set Systems Preferences, Energy Saver, Schedule, Startup or Wake, to
    --       Every Day, at 15:45hr, and
    --       Set eyeTV Programs Update Script to run at 16:00hr every day
    property runTime : missing value
    on run
       set runTime to (get current date)
       set (time of runTime) to 10 * hours
      repeat while runTime < (get current date)
         set runTime to runTime + 1 * hours
      end repeat
      display notification "eyeTVAutoUpdate Script initialised: " & return & (current date)
    end run
    on idle
       try
       tell application "EyeTV"
          activate
          close controller window
       end tell
       tell application "System Events"
          tell process "EyeTV"
             keystroke "g" using command down
             delay 1
             click (pop up button 1 of window 1)
             delay 1
             click menu item "Go to Now" of menu 1 of pop up button 1 of window "EyeTV Programs"
             delay 1
             click (pop up button 1 of window 1)
             delay 1
             click menu item "Update DVB Program Guide" of menu 1 of pop up button 1 of window "EyeTV Programs"
          end tell
       end tell
       display notification "eyeTV Programs Updated: " & return & (current date)
    on error errorMessage number errorNumber
       display notification ("An error occurred: " & errorNumber as text) & return & "Description: " & errorMessage as text
    end try
    repeat while runTime < (get current date)
       set runTime to runTime + 1 * hours
    end repeat
    display notification "Next Update of eyeTV Programs: " & return & runTime
    display notification "eyeTVAutoUpdate Script Return: " & (runTime - (get current date))
    return (runTime - (get current date))
    end idle
    Although I have not yet tested it, simply change the last repeat while loop time interval [now one hour] to suit, say to 8 or 24 hours.
    For example...
    repeat while runTime < (get current date)
       set runTime to runTime + 8 * hours
    end repeat
      repe

Maybe you are looking for