Scaling a movieclip in the restricted area

Dear friends,


I have a movieclip (view_mc), I want to put across a small area.


I did an IF statement,


When its width and height are less than the width and height of the restricted area, then evolve.


but when he reached the width and height of the restricted area, that I can't narrow it down.


Here is the code:

view_mc.addEventListener(Event.ENTER_FRAME, on_enter_scale);


function on_enter_scale(e:Event):void
     {
          if((view_mc.width < this.restricted.width && view_mc.height < this.restricted.heigh) && (view_mc.x < this.restricted.width && view_mc.y < this.restricted.height))
          {
               view_mc.scaleX = newScale * (clickedY / stage.mouseY);
               view_mc.scaleY = view_mc.scaleX;
          }
     }


How can I solve this problem.


There is a logic that is missing here.


How can I program the logic of the problem.

I don't think that the forum has added additional support for the code below:

var targetScale:Number = 1.5;
btn.addEventListener (MouseEvent.CLICK, scaleF);

function scaleF(e:Event) {}
view_mc. Toggle = btn.toggle
{if (! view_mc.hasEventListener (Event.ENTER_FRAME, on_enter_scale))}
view_mc.addEventListener (Event.ENTER_FRAME, on_enter_scale);
}
BTN. Toggle =! BTN. Toggle;
}

function on_enter_scale(e:Event):void {}
If (view_mc.width< this.restricted.width="" &&="" view_mc.height=""><>
{if(!view_mc.) Toggle)}
view_mc. ScaleX =. 5 *(view_mc.scaleX+targetScale);
view_mc. ScaleY = view_mc.scaleX;
If (Math.ABS (view_mc. ScaleX-targetScale)<>
view_mc. RemoveEventListener (Event.ENTER_FRAME, on_enter_scale);
view_mc. ScaleX = view_mc. ScaleY = targetScale;
}
} else {}
view_mc. ScaleX =. 5 *(view_mc.scaleX+1);
view_mc. ScaleX = view_mc.scaleY;
If (Math.ABS (view_mc. (ScaleX - 1).<>
view_mc. RemoveEventListener (Event.ENTER_FRAME, on_enter_scale);
view_mc. ScaleX = view_mc. ScaleY = 1;
}

}
} else {}
not in the restricted area
resized accordingly?
view_mc. RemoveEventListener (Event.ENTER_FRAME, on_enter_scale);
}
}

Tags: Adobe Animate

Similar Questions

  • Set the movieclip to the stage

    Here is my code, I don't know why it is not f ' ing work?

    function newBomb() {}

    var newBomb = attachMovie ("bomb", "bomb");

    newBomb._x = 200;

    newBomb._y = 200;

    }

    newBomb();

    Please tell me what stupid thing I did.

    And Yes, the linkage/properties of the movieclip in the library are correct (link: bomb).

    Try to avoid using the same name for different things and see if it works.  Name of the instance, which is the same as the linkage and not to name the same as the function variable.

  • How to restrict the movement of movieclip on the stage?

    Hi, I want to spend my movieclip to the left and right, but he moves out of the scene. I want to restrict the movement of X the width of my step.

    This is my code for the movement of movieclip:

    import flash.events.KeyboardEvent;

    stage.addEventListener (KeyboardEvent.KEY_DOWN, moveavatar);

    function moveavatar (event: KeyboardEvent): void

    {

    If (event.keyCode is 39)

    {

    avatarmove.x += 10;

    }

    Else if (event.keyCode == 37)

    {

    avatarmove.x = 10;

    }

    }

    How do I limit the movement of X the width of my step so it won't leave the stage? Thank you.

    You have the registration point in the upper left corner. In my case, I had to focus. If you want to keep as you have, replace with this:

    import flash.events.KeyboardEvent;

    stage.addEventListener (KeyboardEvent.KEY_DOWN, moveavatar);

    function moveavatar(event: KeyboardEvent): void {}

    avatarmove.x = Math.max (0, Math.min (stage.stageWidth - avatarmove.width, avatarmove.x - int(event.keyCode==37) * 10 + int(event.keyCode==39) * 10))

    }

  • scaling of symbols and the motion tweens

    I've created an animation with various symbols and motion tweens, especially on an external level timeline.  In the end, I realized that the resolution is too low for a quality quicktime export.  After the scaling of the canvas of 550 x 400 at 1650 x 1200, I tried scaling the rest of the objects using the brackets "edit multiple images", but every scene I try to do that, only some of the executives are put across.  They begin to scale and move in all directions, oscillating between the original and new positions.  So, I have to go back and manually scale/reposition the interpolations.  I'm doing something wrong with the edict several frames thing or something?  Or y at - it an easier way to do this that I've not seen?  Thank you

    -Gene

    "

    1. go in the settings of publication in the file menu. Go to the HTML tab change the film size in Dimensions: section. Change the setting from 'Match Movie' to 'Pixels' and enter the dimensions you want. Publish. If there is no bitmap, then it should look acceptable.

    2. If ABSOLUTELY everything in your movie is in the timeline, then you can select all frames in all layers, then select the images to copy in the Edit menu or right click on the layers menu. Create a new movieClip. Select the first frame on the first layer and then select Paste frames from the Edit menu or the menu right click on this image.

    Now, you have a copy of your entire movie into a movieClip. Create a new movie at the new size you want. Copy and paste this new movieClip in library of the new film. Save the new movie. Drag the movieClip on the stage of the new film. Stretch the movieClip to adapt to the new size of the stage. Save again. Play. You should now have a movie that turns to the new size of the image. Depending on how your Actionscript wrote, you may need to make some changes.

  • Is it possible to determine which parts of the runtime of the BCI are required?

    Recently, I added a few .NET controllers to allow me to use c# written by third-party DLLs.

    A few years ago, due a number of reasons, rather that runtime CVI together with our shipping software, we have stripped the small pieces that were needed to make the software run, which kept the overall size of the package down. Given the size of the complete engine (134MB) and the fact that we probably use very little of it, I'm reluctant to add, given the fact that the package occupies only around 10-12 MB.

    I discovered yesterday that the latest version of our software does not work on machines other than my development machine - either're missing us now stuff CVI.

    You might wonder why I do not use the distribution manager to build. In other words, due to the law American that we are prohibited from any form of encryption beyond a certain level as part of a software project we produce, and the installer at the moment entered in this category.

    So that's my dilemma. My questions are...

    (1) is it possible to determine what might be missing by the simple knowledge that the addition of .NET controllers caused the problem.

    (2) if I use the distribution manager to make a working copy of the software, would it not straight to the before enough to then identify what additional things other than my own code, has been added to make the software work and if so where is the installer put it. I have the impression that something gets stuck in Windows\System32, but are there other places too?

    I hope you can help

    Concerning

    Gavin Summers

    You have been really helpful guys... I'm sorted now... The problem arose mainly because I have 9 upgrade to 2010 and then 2010 SP1 for this project. I already had a local copy of the CVI. Reflector.dll in my (9.0.248) project, or something similar, so that was the cause of the problem, but because I just started testing on machines other than my development machine, I haven't noticed so far.

    I went looking for the new copy of this file, when we moved to 2010 SP1, but found no one. I didn't realize he was locked up in the House - I think he could be in the system32 directory before. I have now managed to get a copy from there and when included in the installer, the project is now working on other machines.

    As I said before that the situation is far from the idea, saw out the locks take out the execution engine of the CVI, but because of the way we ship software and due to the restrictions that are imposed by the U.S. Government on issues of encryption, full runtime is now too big to ship with the software , and we cannot use the MSI installer as its encryption level at least at the last valuation was too high.

  • All of my screen is extra-large, the settings are in the smaller but everything is extra-large.

    The settings are in the smaller but everything is extra-large.

    The settings are in the smaller but everything is extra-large.

    2. set DPI scale
     
    3 right-click on an open office space > view > choose small or medium icons
  • Create the directory in the "shared" area

    Hi all

    I can't find a solution for this one...

    Is it possible to create a directory in the "shared" area of the PlayBook?

    I can write the file, but I would like to have a directory structure. And whenever I invoke createDirectory I have error:

    Error #3001: File or directory access denied.
    

    I could create directories in my first App version, but it is with the SDK 0.9.1.

    Certain restrictions have been updated with SDK 1.0.x?

    (Bbtablet.xml of config file, I after the access_sharednode, and I can write files anyway)

    @Acenet, I think that you don't really get your blackberry - tablet.xml in the file correctly .bar file.  Please check uncompressing the .bar file and inspect.  The file should be named air/blackberry - tablet.xml in the archive and check that the contents don't really have access_shared specified.

  • Add the restriction of access to the file – cannot open / view the files more

    I added a restriction of access to a particularly important issue. But so all the files inside are now either opening. I get a prompt this unknown format - or bad file descriptor, or can not read file header etc. What should I do? Help, please

    Hi Abhay,

    1. What is the complete message you receive?

    2. where is this file?

    3 is confined to a particular file? What kind of file is it?

    4. your computer is on a domain?

    5. have you limited access for reading and writing?

    This problem can occur if the restriction of folder is not set correctly.

    We can refer to the articles and check if it helps.

    "Access denied" or other errors in the access to or work with files and folders in Windows

    How to open a file if I get an access denied message?

    Hope the helps of information. Let us know if you need help with Windows related issues. We will be happy to help you.

  • I can't open any link in an email because of the restrictions on the pc after the latest MS updates on 40-26-2013. How to fix this?

    After that my system downloaded automatically updates latest of Microsoft, I can't click a link in an email without getting the message that this action has been canceled due to restrictions on this PC; Please contact your system administrator.

    My login has administrator access.

    I am running Windows 7 ultimate, Office 2010, IE 10.

    How can I fix?

    Duane Goodman

    Hi Duane,

    1 are you facing issue while accessing Outlook 2010 links?

    2. are you referring to the webmail or Outlook 2010?

    I recommend you to check the updates are installed on your computer before this issue.

    See the Windows updates are installed: http://windows.microsoft.com/en-US/windows7/See-which-Windows-updates-are-installed

    Note: If the update is related to outlook or any update of security, I recommend you to uninstall this particular update and check.

    Remove an update: http://windows.microsoft.com/en-in/windows7/remove-an-update

    I recommend disabling the security software and check.

    Disable security software: http://windows.microsoft.com/en-US/windows-vista/Disable-antivirus-software

    Note: If you need to temporarily disable the security software, you should reactivate as soon as you are finished. If you are connected to the Internet or a network, while your antivirus software is disabled, your computer is vulnerable to attacks.

    If you are referring to Webmail, please refer to the steps in the following Microsoft article.

    The problems of access to webmail using Internet Explorer: http://support.microsoft.com/kb/2483955

    Note: There is also good place for Internet Explorer 10.
      
    Note: The reset of Internet Explorer is not reversible. After a reset, all previous settings are lost and cannot be recovered. Rather than reset, you might want to reset specific settings in the Internet Options dialog box or delete your webpage history.

    Keep us updated on the status of the issue.

  • I get an error, the "restricted user" when I try to install a program on the administrator account.

    Original title: usuario restrito

    I have two users in my laptop. The two are of me. One is administrator, and the second is a standard user. I set it up like this for more security.

    This week I had issues with Real Player, it took too long to open, modify and restore the db. I deleted his PB and it was always damaged for some reason any. So, I decided to remove the real player and do a fresh install.
    But I could ' t because I get a message that I am a user 'restricted' (usuario restrito) and need to seek special privileges to the system administrator.
    Then, I installed Real Player successfully to the administrator account. And it works. But I can't access it from my normal user account.
    So I have two questions:
    1. How can I install the software in the standard account (overcoming the "restricted" user).

    OR

    2. How can I use the Real Player software installed in my standard account administrator account?


    You can allow ordinary users to perform installations by disabling UAC. Not recommended!

    Sorry, I can't tell you what the problem is when you run RealPlayer as a standard user. Your report "But I can not access it from my regular user account" is too vague to draw conclusions.
    You write "I have two users in my laptop. One is administrator. ' It is a very risky way of running Windows. If your machine develops a problem with your account only admin and then you are in a diabolical situation. Happens all the time... At any time, you must have a spare fully tested and documented, even admin account that you have a spare House key (so that you don't break a window in the case where he lead astray you).
  • File navigation on OS x using openDlg() - why all the folders are grayed out?

    I am configuring a file and folder browsing dialog that works for the two Win/OSX and with filters to narrow the search to specific file types dialog box. I received a lot of help from another user on the forum (Matias Kiviniemi) in order to obtain the function of filter working - but now I have another problem: a little strange.

    When you browse the files under OSX, all the folders are greyed out!error.jpeg

    You can always navigate (somewhat) via the Favorites list and directory tree button at the top in the Center, but actually clicking in the records does not at all.

    I also tried saveDlg() to browse the files, but I have exactly the same problem with greyed out records. SaveDlg() is not the second parameter (the filter function) to restrict the dialogue to a specific file type - which is something that I need.

    // Utility functions for checking if the OS is Win/OSX
    function isWindows(){
        return app.systemInformation.indexOf("Operating System: Windows") >= 0
    }
    function isMac(){
        return app.systemInformation.indexOf("Operating System: Mac") >= 0
    }
    
    
    // All params below are strings
    function promptFile(dialogMessage, dialogType, extFilter, oldPath){
    // Description: Opens up a file or older dialog window for browsing (Win/OSX)
    // Returns: Absolute path (string) to the file or folder that was picked by the user
    
    
        // File
        if (dialogType == "file"){
    
    
            // Create filter function for the File.saveDlg -function
            var filter = null
            if (isMac()){ // OSX
                if (extFilter){
                    var filter_regex = new RegExp("[^\.]*\."+extFilter+"$")
                    filter = function (file_entry){
                        return filter_regex.test(file_entry.name)
                    }
                }else{
                    filter = function(){ return true } // All and any file(s)
                }
            }else if (isWindows()){ // Win
                if (extFilter){
                    filter = extFilter.charAt(0).toUpperCase() + extFilter.slice(1)+"-files:*."+extFilter
                }else{
                    filter = "All files:*.*" // All and any file(s)
                }
            }else{
                filter = null
            }
    
    
            // Create file dialog
            var path = new File(oldPath);
            // var dialog = path.saveDlg(dialogMessage, filter); // Same kind of error with saveDlg
            var dialog = path.openDlg(dialogMessage, filter, false);
    
    
        // Folder
        }else if(dialogType == "folder"){
            alert("folder diag:\n" + oldPath);
    
    
            // Create folder dialog
            var path = new Folder(oldPath);
            var dialog = path.selectDlg(dialogMessage);
            while (dialog.alias){
                dialog = dialog.resolve.selectDlg(dialogMessage);
            }
        }
    
    
        if (dialog){
            return dialog.fsName.replace(/\\/g, "/") // Back to Front slashes
        }
    }
    

    I'll cross post since my last response to the other crossed the moderation and released after you posted this (and it is relevant for this topic)

    There seems to be backup dialog boxes _SEVERAL_ versions

    • file_entry.saveDlg (): file_entry content is the default value, but do not know if he has locked her
    • File.saveDialog (): same as file_entry.saveDlg, but none value of screening. Maybe it is not locked to original dir
    • folder_entry.saveDlg (): looks identical to file_entry.saveDlg, do not know if there is a difference.
    • Folder.selectDialog: seems more versatile, "simply to choose a file.

    You probably just do some trial and error to choose one that fits, what are the rules everyone has. So far I think Mac has no option for "create a new file, but only this extension." Extension filter only seems to apply to existing opening and win (although even there, he hides just, you can actually set different extension in her typing).

    Confusion between the part which is the "grayed out of all cases" it would imply in fact wants the filter even though the docs say it is not. I.e. you'd need to do a filtering function that accepts two folders or files with right like below (not tested)

    filter = function (fileSystemEntry) {}

    If {(fileSystemEntry instanceof file)

    Returns true

    } else {}

    return filter_regex.test (fileSystemEntry.name)

    }

    }

  • How to drag and drop multiple movieclips at the same time

    Hello world

    I'm a new actonscript 3 and adobe flash CC user and I am building an application but I have been stuck for several days. I have looked everywhere and tried everything I could think of, but I can't yet find a solution to my problem that I thought were pretty basic.

    Basically, let's say I have a rectangle and a circle on the stage. Once I did of the movieclips and assigned an instance name to each of them, I want to be able to perform a drag and drop the Rectangle so that both the rectangle and the circle become movable at the same time.

    For now, I have a mouse down events listener associated with the instance of rectangle, a method startDrag assigned to the rectangle instance and another assigned to the circle. But in this configuration, when I click on and drag the rectangle, only the circle is mobile (only the last line in the code is taken into account).

    I don't know if what I'm trying to achieve is feasible, but any help will be greatly appreciated, thank you!

    The startDrag() method can only work for one object at a time, so in your case the Treaty the last of them, designated the task.  This approach is to temporarily to plant the two objects in a container and then drag the container.

    rectangle.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag);  When I click on the rectangle

    var dragMC:MovieClip = new MovieClip();
    addChild (dragMC);

    function fl_ClickToDrag(event:MouseEvent):void

    {
    dragMC.addChild (rectangle);        move objects in the container
    dragMC.addChild (circle);
    dragMC.startDrag ();
    }

    stage.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop); When I release the mouse button

    function fl_ReleaseToDrop(event:MouseEvent):void

    {
    dragMC.stopDrag ();
    Rectangle.x += dragMC.x;         Adjust the positions of the objects to their new location
    Rectangle.y += dragMC.y;
    Circle.x += dragMC.x;
    Circle.y += dragMC.y
    addChild (rectangle);                 move back to the scene objects
    addChild (circle);
    dragMC.x = dragMC.y = 0;       reset the benchmark for the dragMC
    }

    All this stuff of repositioning in the Drop function is necessary because when you drag the container, the positions of the content are still on their original coordinates inside the container.  So when you drop them they will resume their x / y positions in their new parent, meaning they go back where they were.  Reposition them where they have been trained to take into account the change in the position of the dragMC.

  • Control a movieclip with the position of the mouse

    Hello everyone,

    I worked on a small project at work, I'm trying to controll a movieclip which consists of 60 still images of an aircraft (total 120 frames) that when played will show a view of 360 degrees of said aircraft. I can make it work with buttons, but ultimately I want to control the movieclip by moving the mouse. If anyone can help, that would be wonderful. Thanks in advance.

    Here is the code:

    import flash.events.MouseEvent;

    AC. Stop();

    stage.addEventListener (MouseEvent.MOUSE_MOVE, mouseMove);

    function mouseMove(event:MouseEvent):void
    {
    If (mouseX > 800 & & (mouseX < 1600))
    {
    ac.gotoAndStop (ac.currentFrame + 1);

    if(AC.currentFrame == 120)
    {
    ac.gotoAndStop (1);
    }
    }
    on the other
    {
    ac.gotoAndStop (ac.currentFrame - 1);

    if(AC.currentFrame == 1)
    {
    ac.gotoAndStop (120);
    }
    }
    }

    Using this code, the SWF file acts ok without error. I can do the movieclip play in any direction, however, when you move the mouse in the opposite direction that the movieclip continues to play forward or backward.

    Thank you

    Tommy

    There are at least two ways you can address this problem and they both require to control the position of the mouse more closely.  Now you have a general... If it's 800 > ahead and if his < 800="" step="" back,="" but="" when="" you="" step="" back="" from="" 1200="" to="" 1199="" you="" are="" still=""> 800, if you take one more step.  You need to either follow the change in mouse position or the position of the mouse to determine the framework of movieclip.  The second one is probably easier to design and will also be more accurate if the intention is to have a rotation for a displacement of the full scale of the mouse... otherwise you could just step back of a pixel at a time and in 120 pixels of movement... that might be what you want-the purpose is not explained in what you provided.

    (1) following the change of the position of the mouse - you must keep track of where the mouse was against where the mouse is when you check it... if(previousMouseX > currentMouseX)... you need to make the animation go back, etc...

    (2) with the position of the mouse to determine the frame movieclip - divide 120/1600... This is the number of images per pixel.  Take the current value of mouseX and multiply by that and make it an integer - go to this issue of image in the animation... simplifies this entire function similar to...

    function mouseMove(event:MouseEvent):void {}

    ac.gotoAndStop (int(mouseX*120/1600));

    }

    but refine to remember that there is no image 0

  • Help to copy the timeline of the movieclip on the stage of chronology for exporting .mov

    Hello

    I'm under Flash CS5 on a Macbook Pro, version 10.6.8.

    I'm trying to convert .swf to a .mov to an animation I created. I already tried the 'export' in Flash Basic options, but it exports only the "scene 1" first frame and not the real movieclip (648 images) I created which is placed in the scene 1.» Of after online videos / websites, I've gathered that I need to copy the movieclip on the stage 1 layers and then export that normally. While I can do (select the layer of the timeline of the movieclip, make a right click Copy frames and then paste this layer in scene 1), glued on the stage of the layers are out of the original (movieclip). Is there a quick way to move all layers in the timeline (frames) the scene 1 without losing their location on the stage? It is a fair way to export the movieclip in. MOV directly without messing with the parent stage 1?

    Thanks in advance!

    If you stretched it scenario main enough to show all the images in 645 and there not animate, implying that there are more nesting inside that you need to take into account. You'll need transform these MC incorporated into graphics so and stretch out them to full length.

  • Load a movieClip in the library, then changing the text inside

    I have a movieClip in the library with the name of binding as "LinkClass" class  I can do appear on the scene, but there is an area of dynamic text inside called "linkText" that I can't seem to make it work.  Ideas?  Here is the code:

    myLink = new LinkClass();

    myLink.name = "linkButton";

    box.boxMC.linksMC.addChild (myLink);

    myLink.linkText.htmlText = 'hi. '

    so, you don't have a child object named linkText in your object with the LinkClass class.

    If you think that you do not have such an object, make sure that it is not part of a timeline Tween and there on frame 1 of your LinkClass object.   If linkText is created on the stage with the tool text, click it to select it in the properties panel, paste linkText.  If you think you've done everything right, paste a screenshot here that shows your textfield on selected scene, the calendar, and the properties panel.

Maybe you are looking for

  • HP deskjet 3540 series (D142AF: print validation error)

    I am trying to print from my computer hp laptop on my wireless printer and I got valedating of the printer... Please can you help me now?

  • Cancel remember details

    I want to stop the user name and password automatically come on a particular site

  • Driver RFBUS missing for Satellite P750-11W

    Hello! I have Toshiba Satellite P750-11w and Toshiba RFBUS driver fails and bluetooth will not not because of that.I have download the latest drivers and installed... but this fail Can you help me? Goodbye & thank you

  • Re: Which computer Toshiba laptop should I buy?

    Hey, I want to buy the Toshiba laptop computer, two laptops by this review site.I want to buy one of them, but which?[http://www.squidoo.com/toshiba-satellite-l505-gs5037-trubrite-15-6-inch-laptop]

  • A lot of problems at all the podcast shows we produce

    Hi guys,. We have a few podcast shows we produce and publish. The problems below seem to have an impact on all of these shows that I will focus on a specific show for reasons of readability and the confusion. The show is Smallzy surgery; https://iTun