Resizing Movieclip in a restricted area.

Dear friends,
I have 2 moveclip called view_mc and restricted    and button called btn_scale.
When the user click and drag btn_scale, it resizes the view_mc where the width and height of view_mc dosen't exceed the width and height/2 of restricted area.
I made that.  But when view_mc reaches the width and height/2 of restricted area, I can't resize view_mc to be samller.
(The btn_scale looks like it's disables and can't use it)
I think some logic is missing. I highlighted the code that is missing some logic.
var clickedX:Number;
var clickedY:Number;
var newScale:Number;
stage.addEventListener(MouseEvent.MOUSE_DOWN, on_stage_down);
stage.addEventListener(MouseEvent.MOUSE_UP, on_stage_up);
function on_stage_down(e:MouseEvent):void
if(btn_scale.hitTestPoint(stage.mouseX, stage.mouseY))
  clickedX = stage.mouseX - view_mc.x;
  clickedY = stage.mouseY - view_mc.y;
  newScale = view_mc.x;
  view_mc.addEventListener(Event.ENTER_FRAME, on_enter_scale);
function on_enter_scale(e:Event):void
stage.addEventListener(MouseEvent.MOUSE_MOVE, on_move_scale);
//////// Some Logic is missing here ////////
function on_move_scale(e:MouseEvent):void
if(view_mc.width < restricted.width && view_mc.height < restricted.height/2)
  view_mc.width = view_mc.height =  newScale * (stage.mouseY / clickedY);
function on_stage_up(e:MouseEvent):void
view_mc.removeEventListener(Event.ENTER_FRAME, on_enter_scale);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, on_move_scale);
please help me solve this problem.
Thanks alot in advance.

Update the following code in your application...
function on_move_scale(e:MouseEvent):void
if(view_mc.width <= restricted.width && view_mc.height <= restricted.height/2)
  //Find new scale
  var temp = newScale * (stage.mouseY / clickedY);
  //Check if the new scale is within the limit or not?
  if(temp > restricted.height/2 || temp > restricted.width)
   //If its out of the limit update the scale to max value for scale.
   temp = (restricted.width)<=(restricted.height/2)?(restricted.width):(restricted.height/2);
  //Apply scale to MC.
  view_mc.width = view_mc.height =  temp;
//You should have a simillar check for the lower bound also ideally it will take only 0 as minimum scale value

Similar Messages

  • _xmouse on resized movieclip

    I am creating a video player and have a scrub bar which you
    can click on the timeline to get a point in the video.
    The player is dynamic in size and can be opened at any size
    you require, set by the movie dimensions in the HTML.
    I have the controls for the player resizing and positioning
    dynamically with the width of the movie, so the scrub bar is
    dynamically changed in length.
    Everything works except when I click on the bar and retrieve
    the _xmouse position is is still returning the original coordinates
    of the movieclip, its size when created.
    The width of the bar in pixels is being returned correctly
    when I check, it is just the _xmouse coordinates which are
    returning original values.
    e.g. (for ease I have rounded things up)
    If I increase the width of the movieclip from its original
    400px to 800px wide, when I click 3/4 of the way along the resized
    movieclip I get a result of 300px instead of 600px.
    Do I have to reset something?
    Thanks

    use:
    content_mc.work_btn.mouseChildren=false
    content_mc.work_btn.buttonMode=true;

  • The "always allow" button is grayed out in settings regarding cookies, and I can not find where to change the setting.  (Restrictions are not on.)

    The "always allow" button is grayed out in settings regarding cookies, and I can not find where to change the setting.  (Restrictions are not on.)  Do you know where I go to change the setting to allow me to "always allow" cookies?

    Hi lisaarnett111,
    If you are having issues turning on Always Allow for cookies in Safari on your iPad, you may want to check to make sure that you don't have Private Browsing enabled, as noted in the following article:
    Turn Private Browsing on or off on your iPhone, iPad, or iPod touch - Apple Support
    Regards,
    - Brenden

  • I forgot the passcode to turn off restrictions. I have restored my iPad back to the factory settings and then synced it with the latest backup. The restrictions are still on and it is asking for the passcode. Can someone tell me how to get that off.

    I forgot the passcode to turn off restrictions. I have restored my iPad back to the factory settings and then synced it with the latest backup. The restrictions are still on and it is asking for the passcode. Can someone tell me how to get that off.

    The only option is to wipe the device clean and restore it to factory settings.  Hope you have a backup.
    Follow the instructions in  iOS: How to back up your data and set up your device as a new device http://support.apple.com/kb/HT4137 to restore the device to factory settings.
    Once you have setup the device as a new one, you can then sync it back with your iTunes account and all your music, apps, contacts and any other content sync'ed with iTunes will be loaded on the device. Any content that is stored only on the device and not sync'ed with iTunes, like app logins or data, will be lost during this process. Be forewarned that this is a long process and can take a couple of hours or more to complete. This can be painful, but it is necessarily so to prevent users from working around the security settings. After the restore is complete, you can setup a new Restrictions passcode. Make a note of the passcode to avoid this situation in future.
     Cheers, Tom

  • My restrictions are on and I didn't turn them on.  The code is not the one I use to unlock my ipad.  How can I find out the code to turn off my restrictions and why did it turn on?

    My restrictions are turned on. I didn't turn them on.  The only code I've used on my ipad is to unlock it and that code won't work on my restrictions.  How do I turn off restrictions and prevent them being turned on again?

    The only option is to wipe the device clean and restore it to factory settings.  Hope you have a backup.
    Follow the instructions in  iOS: How to back up your data and set up your device as a new device http://support.apple.com/kb/HT4137 to restore the device to factory settings.
    Once you have setup the device as a new one, you can then sync it back with your iTunes account and all your music, apps, contacts and any other content sync'ed with iTunes will be loaded on the device. Any content that is stored only on the device and not sync'ed with iTunes, like app logins or data, will be lost during this process. Be forewarned that this is a long process and can take a couple of hours or more to complete. This can be painful, but it is necessarily so to prevent users from working around the security settings. After the restore is complete, you can setup a new Restrictions passcode. Make a note of the passcode to avoid this situation in future.
     Cheers, Tom

  • ' delete an app. All apps wiggle incl. the one in questions. However the app I want to delete does not show the x button. I reseted, also restrictions are on with on for apps delete. Suggestions?

    ' delete an app. All apps wiggle incl. the one in questions. However the app I want to delete does not show the x button. I reseted, also restrictions are on with on for apps delete. Suggestions?

    mardemar wrote:
    ... - the only one without an x delete button.
    What is the name of this App and where did you get it...?

  • Why can't I make a kik account? I have IOS6 and higher and my restrictions are turned off! Please help!

    Why can't I make a kik account? I have IOS6 and higher and my restrictions are turned off! Please help!

    What happens when you try?
    See:
    iOS: An app you installed unexpectedly quits, stops responding, or won’t open
    Contact the developer/go to their support site
    https://kikinteractive.zendesk.com/home
    Restore from backup. See:
    iOS: How to back up
    Restore to factory settings/new iPod

  • Can free apps be downloaded when restrictions are on?

    Can my grandson order free applications when restriction are on?  I want him to be able to play but not to be able to order expensive apps  (he is 6 years old).

    Just to confirm this, if you set the restriction for Installing Apps to the Off position, then App Store icon will dissapear from the Home screen entirely. so no not even Free Apps can be downloaded.
    Setting it to On, is the equivalent of doing nothing, so it becomes pointelsss to set restrictions if they are not enforced shall we say.
    The only way to prevent purchases of payed apps but still allow free Apps, is to remove the Payment option form the associated apple ID.  That way there is no way to pay so no way to download paid apps.
    Go to  Settings->iTunes and App Stores->Apple ID->View Apple ID->Payment Information-> Set it to None.

  • PHP/MySQL access denied=restricted+area

    We just migrated to a new OS X Tiger running WebSTAR 5.4,
    w/MySQL 4.1.x, PHP 4.4.0 (I'm a bit vague on the MySQL version and
    am having trouble logging in via terminal to check).
    All my previous login pages set up using DWMX 2004 now refuse
    to redirect to the intended page when I use the correct username
    and password (URL returns
    "degree_login.php?accessdenied=Restricted+Area"). FWIW,
    deliberately typing the wrong username and/or password correctly
    yields the error page. So it seems something is working but not the
    login w/correct user/pwd.
    I know MySQL 4.x changed the password system so that they're
    encrypted, and I fixed this using the MySQL manual instructions
    (old password). But I don't see this as being related to my current
    problem.
    Since I'm really stymied as to where to start, and wondering,
    based on the error in the URL, what anyone might suggest to look
    for. I'm assuming it's still a permissions issue with the MySQL
    table, but I'm not sure why this would be the case. FYI, related
    pages that use the same database, but different table, still work
    fine. Any suggestions greatly appreciated.

    What those error messages are saying is that PHP can't connect to the database.
    This is because it's told to communicate with MySQL via /var/mysql/mysql.sock, but MySQL isn't listening there.
    That could be because your MySQL server is configured differently. Check /etc/my.cnf to see where the server is listening. You can read this file with any application that can open text files - no terminal experience necessary (although if you want to use the terminal, it's simply - 'cat /etc/my.cnf' and look for the 'socket' lines)
    If I reinstall MySQL, will I lose the data in my database?
    That depends, but it is not something you need to do at all, so don't worry about it.
    I read somewhere that I need to edit a file called /var/lib/mysql/mysql.sock, but how do I get to this file in order to edit it? I can't find it anywhere? I've been told it's a "hidden" file, but no-one has told me WHERE it's hidden!
    Red herring. Ignore whatever you read. In either case it's telling you WHERE you need to look - /var/lib/mysql/ but that isn't relevant here.

  • Creating Restricted area of Website

    How do I create the restricted area of website based on weblogic groups, for example whenever enduser invokes the URL in URL bar, I have to pop-up a small window by asking the username and password.. based upon that username I need to indentify which group he belongs to and I have to display that group home page. Live example like what you people are poping up the dialog box for BEA Customers.. to login..
              thanks for your support..
              

    look into the ACL documentation .... it is straightforward and simple.
              u could provide a list of url's that could be accessed by everyone and some
              only by others;
              -Sumanth
              "chandrasekhar patarlapalli" <[email protected]> wrote in message
              news:39e1bf72$[email protected]..
              How do I create the restricted area of website based on weblogic groups, for
              example whenever enduser invokes the URL in URL bar, I have to pop-up a
              small window by asking the username and password.. based upon that username
              I need to indentify which group he belongs to and I have to display that
              group home page. Live example like what you people are poping up the dialog
              box for BEA Customers.. to login..
              thanks for your support..
              

  • Unable to download candy crush on iPad, all restrictions are off but blank page appears when directed to download from internet

    Have updated software to latest version, ensured all restrictions are off, can only find guides and cheats in App Store but not the actual game. Have tried to download from internet but get redirected back to App Store where blank page appears and nothing comes up....

    I also encountered this problem. I'm afraid I didn't meticulously document my work, but here are the step I took that might be relevant. I downgraded to IE9 and then down to IE8. I tried the
    BypassSSLNoCacheCheck and BypassHTTPNoCacheCheck settings in the registry, which didn't work for me. I tried moving the location of the temporary internet files folder by modifying it directly in the registry:
    HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ User Shell Folders
    HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ Shell
    This didn't work either. While I could see that I had the invisible content.ie5 folder in there, plus the randomly named folders, there was nothing cached in those folders. Cacls.exe showed
    that the user had full control, and I could past files into those folders. This seemed to rule out a problem with permissions on the temp ie files folder. 
    The big clue for me was this thread when someone said that it worked for the administrator account, but not others. While logged in as the affected user, I tried deleting:
    HKCU\Software\Microsoft\Internet Explorer (the entire folder, with all its subkeys)
    and also: HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings (again, the entire folder, along with all its subkeys).
    I tried running IE again, and downloads work again! In the internet control panel, I now see a path listed for the temporary files folder (the path I specified), and the cache is set to 50MB
    now instead of being stuck at 0. I haven't tried updating back to IE9 yet.
    I suspect that changing the location of the temporary IE files folder was unessecary, and that all that I really needed to do was delete the two regkey folders. IE10 may be adding some setting
    there that gets left after uninstalling it that causes IE9 and IE8 to choke. Hopefully this will save someone the trouble of rebuilding profiles.

  • HT1975 Why can't I turn off location services?  Restrictions are disabled.  The on off slidebar is grayed out.  I'm concerned my phone is being tracked.

    Why can't I turn off location services?  Restrictions are disabled.  The on off slidebar is grayed out.  I'm concerned my phone is being tracked.

    While I know there are phones that can do this, they really are not powered "off" - they are more in a hybernation state.  However, the iPhone has never worked that way.  Off on an iPhone means truly powered off - nothing is still running so there is no minimal function left ticking away to wake up the phone and sound the alarm.

  • TS4268 I can't get the iMessage or FaceTime to work on my iPod touch.  I updated to the latest iOS.  I have ensured restrictions are off and 'Set Automatically' is selected under date & time settings.  I can enter my apple ID, but it bounces back to the l

    I can't get the iMessage or FaceTime to work on my iPod touch.  I updated to the latest iOS.  I have ensured restrictions are off and 'Set Automatically' is selected under date & time settings.  I can enter my apple ID, but it bounces back to the first login screen.

    I just hit the home key very fast 3 times and it worked. Glad to see that someone suggested this to another person with a mini. My gremlins are all gone.  Yea to the forum .......Marci 73361

  • I can't find my rented movie, even though restrictions are off

    I just rented a movie from iTunes, and when the download finished I looked in purchases, then in videos and I can't find it. Restrictions are off, I checked. Please help!

    You are absolutely certain that the movie is not in the videos app? Close the app and relaunch and see if it appears.
    From your home screen, double tap the home button and the recents tray will appear with all of your recent apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the videos app. Tap the home button or anywhere above the task bar.

  • My ipod is refuseing to download apps for no apparent reason restrictions are off latest ios is on there but i cant press the buy/download button in app store

    my ipod is refuseing to download apps for no apparent reason restrictions are off latest ios is on there but i cant press the buy/download button in app store

    - Reset the iPod. Nothing will be lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Go to Settings>Stoe and sign out and then sign back in
    - Power off and then back on the router.
    - Reset networks settings: Settings>General>Reset>Reset Network Settings
    Could just be an Apple problem. So far I have seen another post today with same problem.

Maybe you are looking for

  • How to Start with new Iphone 4 Factory Unlock ???

    I am getting new factory unlock Iphone 4 day after tommorow and I currently have Jailbreak Iphone 3G...Plz tell what should i do to get started ??? I dont want to to jailbreak iphone 4 right now as the un-teathered jb is not available..So how to star

  • Consignment  inter company stock transfer

    Hi Expert, client have two company code. one company receive a consignment stock. without taking in its own stock, he wants to do stock transfer to other company. si it possible in the system if yes how we can do. Regards, Santosh

  • Templates supplied

    I've opened the Invoice Template that came with Adobe, how to I view the scripts that calculate the price info? Thanks Mark

  • ExecuteQueryForCollection override works in 10.1.2, not 10.1.3EA

    I've overridden executeQueryForCollection in a ViewObjectImpl and it was working in JDev 10.1.2. I'm experimenting with 10.1.3, so I copied my Application and imported it. I'm getting the following error: oracle.jbo.JboException: JBO-29000: Unexpecte

  • Edelivery software cloud download broken?

    On Friday, I was trying to download all of the parts to eBusiness 11.5.10 for Linux x86 via edelivery.oracle.com. I got about 2/3 of the downloads done and need to continue. Today I attempted to continue the downloads. I'm trying to download "Oracle