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

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;

  • Loader content got vanish on resize root movieclip

    Hello,
    I have made 30 dynamic movieclip and I put all these Movieclips in MainMovieclip, each movieclip loads one jpg image dynamically, when i resize root movieclip then
    all graphics got invisible. How can i resize parent movieclip, I can't resize individual loader content because there is complex thing will happen where i need to calculate x y position and height widh for individual,so that i put all movieclip in root moviclip and I resizing root movieclip.

    You likely already solved this issue...
    As I understand it, X, Y, width, and height are only read from the first frame of a loader object. Check to make sure that the content on the first frame of your object that your loading is the same size as the content of the entire object. In other words, if you have content on frame 50 that's 200 px wide in total from the registration point of x=0 y=0, and your content on frame 1 is only 100px wide, you'll need to add a transparent object on frame one (starting at x=0 y=0) that is also 200 px wide. If I understood your issue correctly, this should solve the problem. You can easily do a trace on the size of the object your loading to be sure that it's sizing correctly.

  • Resizing a movieclip correctly?

    I can't figure out how to resize a movieclip correctly. I'm
    trying to make a photo gallery and keep everything a certain size
    but when I try and change the scaling, the movieclip just
    disappears.

    use:
    var pic:Loader;
    var totalImages:int = 10;
    var border:uint = 10;
    var prevX:Number = 0;
    var prevW:Number = 0;
    var i:uint=0;
    var container:Container;  // create a class for your container moviecip
    loadF();
    function loadF(){
        container = new Container();
        addChild(container);
        pic = new Loader()
        pic.load(new URLRequest(myImages))
        pic.addEventListener(Event.COMPLETE, resizeContainer)
    function resizeContainer(e:Event):void{
        container.x = prevX+prevW;
        container.width = pic.width+border;
        container.height = pic.height+border;
        container.addChild(pic);
        pic.x=pic.y=border/2;
        prevW=container.width;
        prevX=container.x;
        i++;
        if(i<totalImages){
            loadF();

  • Resizing parent movieclip without affecting the children

    Hi all,
    What's the best way of  resizing parent movieclip without affecting the children?
    I have a container movieclip that resizes depending on the stage, and when I add another movieclips to it they also resize, but I want them to keep the original size,
    is it possible?
    Many thanks

    Hi, thanks for the reply,
    I already tried this way, I put a bitmap as a background of the movieclip and made only it dependent on the stage size,
    something like that:
    mc.bg.width = stage.stageWidth; (and not mc.width, as its width will change along with the bg width)
    so when I add children to the mc, they don't change any more.
    I'm a .NET developer and new to Flash platform, and I think it would be nice from the community to make a built in property for MovieClip class -
    resizeChildren: Boolean
    I lost a whole day on this problem, because when I drew a movieclip in a designer side I saw that its background size changed along with the size change, and when I added children to it from the code the movieclip's size changed and the background stayed still, quite strange behavior for an HTML guy
    I think that it would be better to consider already drawn movieclip not to have any children yet and have its background as its part (not at(0)) and let the programmer choose later added children's resize behavior.
    thanks again

  • 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.

  • Resizing Flexbook Component at Runtime

    I downloaded the Flexbook component online and have been
    messing around with it for a few days but still can't find out how
    to get this thing to resize during runtime. I did get it set up to
    size when Initializing the component by using the following code
    attached to this message. This is using embeded assets for the
    book. You can see my method I have been trying by looking at the
    resizeBook function. The resize does work but after a few resizes
    then things get slow or errors appear. So if someone that has done
    this can give me a few pointers on where I need to look or if
    anyone has any suggestions I would love to here it.

    quote:
    Originally posted by:
    JeffHouser
    Without drilling down to your code; this is conceptually how
    I'd approach it:
    1) Create a new component that extends Flexbook
    2) Overwrite the height and width properties to trigger an
    invalidatePropertes / invalidateSize invalidateDispayList . Also
    add variables (usually private) named "_heightChanged" or
    "_WidthChanged"
    3) in the commitProperties / measure / updateDisplayList
    check the "changed" variables and perform actions to do the
    resizing. You'll have to do some digging in the FlexBook code to
    figure it out what needs changing.
    The digging in the Flexbook code to see what needs to be
    changed is the issue I am having. I have been working on a new
    resize function which seems to be getting closer but still has
    weird results where the book appears to have shrunk when you
    rollover certain areas but there is residual images of the larger
    version showing.

  • Resizing/moving MovieClips to fit screen problem

    I'd like to make an Android and iOS app with Adobe AIR, but I found a problem I can't solve.
    The Flash document size of the app is 800px x 600px, and I'd like to resize MovieClips to fit Android's and iOS' screens, suporting the Retina display on iOS devices.
    I tried using StageDisplayState.FULL_SCREEN and StageScaleMode.SHOW_ALL, and this does seem to work with static MovieClips, so the snippet would look something like this:
    import flash.system.Capabilities;
    import flash.events.Event;
    import flash.display.StageScaleMode;
    import flash.display.StageDisplayState;
    stage.addEventListener(Event.ENTER_FRAME,process);
    var difN:Number = (((stage.stageHeight*stage.fullScreenWidth/stage.fullScreenHeight)-stage.stageWidth)/2);
    function process(e:Event):void {
              difN = (((stage.stageHeight*stage.fullScreenWidth/stage.fullScreenHeight)-stage.stageWidth)/2);
              stage.scaleMode = StageScaleMode.SHOW_ALL;
    stage.addEventListener(KeyboardEvent.KEY_UP,useFullScreen);
    function useFullScreen(e:KeyboardEvent):void {
              if (e.ctrlKey) {
                        switch (e.keyCode) {
                                  case Keyboard.M:
                                            stage.displayState = StageDisplayState.FULL_SCREEN;
                                  break;
    obj.x -= difN
    However, I'd like to use classic tweens in my application, and this won't work since most of the elements are moving.
    I'd like to rescale/move MovieClips so they don't look distorted and every moving item moves correctly, showing all the content and trying to not make any borders. I read this article but it seems like it doesn't support classic tweens: http://www.adobe.com/devnet/air/articles/multiple-screen-sizes.html.
    Thanks for the help.

    1. scaleMode only has an effect when you embed your swf in an html AND you publish for a percentage.
    2. you need to resize your displayobjects using code and/or in the ide.  if you open your document settings panel (modify>document) and change your stage size you are offered some scaling options.  see if any work for you.

  • "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 block-frame at runtime?

    Hello,
    is it possible to resize and reposition a block´s frame at runtime? We want to implement a configurable form. Why is the frame not a "block-element" but a "canvas-element"? Is there any posibility to change boilerplates at runtime?
    thanks in advance
    Anna

    You can't change boilerplate elemenets at runtime. As such you can't change the block frame.

  • 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?

  • 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.

  • Resizing the oracle form runtime window

    hello guys
    i m making one login form in oracle 6i form builder
    and i want as user run it it open as the rectangle box in the centre of user screen.
    i have done for it but the problem that i m facing inthat is that i m unable to resize the size of oracle form runtime window according to the size og my login
    form window.
    pl tell me how to do this.
    Thanks
    With Regards
    Vishal Agrawal

    Hi
    Since you are using Forms6I - just presss F1 - and search for Set_Windows_Property - example - this will take to a proper note

  • Resizing a MovieClip's contents

    I'm loading an external swf into a movieclip (the external
    sfw plays a
    slideshow of JPEGs). When the slideshow plays, the JPEGs
    extend way beyond the
    bounds of the movieclip. How would one go about constraining
    the JPEGs to
    their original size and centering them on the stage? And
    where would one
    place the actionscript using AS2, on the movieclip itself?

    OK - for anyone that may need it - I played a bit and got it to work:
    var mediaDirList:File = File.documentsDirectory;
    mediaDirList = mediaDirList.resolvePath("tester/");
    mediaDirList.getDirectoryListingAsync();
    mediaDirList.addEventListener(FileListEvent.DIRECTORY_LISTING, directoryListingHandler);
    function directoryListingHandler(event:FileListEvent):void {
        var list:Array = event.files;
        for (var i:uint = 0; i < list.length; i++) {
            trace(list[i].nativePath);
    This seems WAYYY simpler than some of the solutions I looked at, so I'm wondering if it's best practice - it would work cross platform, right?
    Thanks (forgot my manners in the last post).
    Shaun

  • Resizing an applet on runtime

    Is it possibe to dynamicaly resize the applet to for example display a image loaded completly when it is larger then the applet currently is? how can this be done?

    Is it possibe to dynamicaly resize the applet The answer is no if you rely on the real estate given to you by the browser. The trick is to define a minimal area for the applet and just spawn a separate window with something like a JFrame for what you wanted it to do. For example:
    <APPLET CODE = "myApplet" CODEBASE = "." ARCHIVE = "myApplet.jar" WIDTH = 10 HEIGHT = 10></APPLET>
    Check out the applet at the link shown below:
    http://www.aokabc.com/index.htm
    ;o)
    V.V.

Maybe you are looking for

  • How to disable the custom push button in Classic ALV

    Hi All, Iam Using Classic Alv (with out classes).I have a created a push button.now at run time i want to make it dynamic . iam using REUSE_ALV_GRID_DISPLAY for ex. i have some records in my out put. i have a push button "INSERT" For first time when

  • Transcoding Sessions unregistered with CUCM from standby gateway of CUBE with HA usingHSRP

    I have 2 C2921 routers working fine untill I enbale CUBE with HA. After configureing HSRP on ethernet interface, the transcoding and conferencing resources were unregistered on HSRP standby router even though I bind the sccp ccm group to physical int

  • How to use INNER JOIN in such case

    when i program as below[CASE1]. the code is able to active. CASE1: ========================== DATA: WK_BUKRS LIKE T001-BUKRS,       WK_BUTXT LIKE T001-BUTXT,       WK_TABLE(4) TYPE C VALUE 'T001'. START-OF-SELECTION.   WK_BUKRS = 'DECN'.   PERFORM GE

  • PO for services

    Hi all, I have contract for services and contract for material. I issue a PO for service against contract for services and during invoice verification against this PO I want ammount to be posted on material acccount, because these services affect on

  • Smartform PO Output

    HI Experts.                From last few days i was wondering for the right answer for this question. I have a PO and in that I have a table. Table is in main window. Below the main, I have couple of windows at bottom of page, displaying company addr