Center the image when click the movieclip

Need a big help guys...
i am new with flash, and i had swf which contains big image it will resize to best fit.
when i double click the image the clicked position come to center of the stage.
i achived little bit, it zooming but image not come to center position.
i have attached the fla file in it please give me a solution for it
and i have used this script to zoom on double click and bolded 2 lines are to position the image.
imagePanel.onRelease = function()
    if(lastclick - (lastclick=getTimer()) + 500 > 0){
        var sf = Math.abs(imagePanel.loadTemp._xscale);
        if (sf < 100) {
        //trace("zoomIn");      
     var xss = imagePanel.loadTemp._xscale > 0 ? (1) : (-1);
    var yss = imagePanel.loadTemp._yscale > 0 ? (1) : (-1);
    var sf = Math.abs(imagePanel.loadTemp._xscale);
    sf = 100;
    imagePanel.loadTemp._xscale = sf * xss;
    imagePanel.loadTemp._yscale = sf * yss;
    imagePanel.refreshPane();
  imagePanel.loadTemp._x = - (_xmouse) -35;
    imagePanel.loadTemp._y = - (_ymouse) - 150;
    else {
    //trace("zoomOut");
    var xss = imagePanel.loadTemp._xscale > 0 ? (1) : (-1);
    var yss = imagePanel.loadTemp._yscale > 0 ? (1) : (-1);
    var sf = Math.abs(imagePanel.loadTemp._xscale);
    sf = best_fit;
    imagePanel.loadTemp._xscale = sf * xss;
    imagePanel.loadTemp._yscale = sf * yss;
    imagePanel.refreshPane();

Hi friend, just change with following code in the zoom in portion
//////////////Zoom In/////////////////////////////////////           
                //trace("zoomIn");       
   var perX = (_xmouse - 10)/imagePanel.loadTemp._width * 100;
    var perY = (_ymouse - 43)/imagePanel.loadTemp._height * 100;
    var xss = imagePanel.loadTemp._xscale > 0 ? (1) : (-1);
    var yss = imagePanel.loadTemp._yscale > 0 ? (1) : (-1);
    var sf = Math.abs(content._xscale);
    sf = 100;
    content._xscale = sf * xss;
    content._yscale = sf * yss;
       imagePanel.refreshPane();
///////////////Zoom In ends////////////////////////////////////
/////////Position to center the image /////////////////////////
/////////This is part i needed, when i click the image it cannot move center postion, please solve my problem///////////
    /*if(_xmouse<Stage.width/2 && _ymouse<Stage.height){
        imagePanel.loadTemp._x = - (_xmouse) -35;
           imagePanel.loadTemp._y = - (_ymouse) - 150;
    var newX = imagePanel.loadTemp._width * (perX/100);
    var newY = imagePanel.loadTemp._height * (perY/100);
    imagePanel.loadTemp._x = imagePanel.loadTemp._x - newX;
    imagePanel.loadTemp._y = imagePanel.loadTemp._y - newY;
    //imagePanel.loadTemp._x = - (_xmouse) -35;
    //imagePanel.loadTemp._y = - (_ymouse) - 150;
The code that i had newly included is marked with red color.
Please reply...

Similar Messages

  • When trying to download an APP, it's requesting answers to 3 security questions and it hangs up the iPad when clicking the drop down for the questions...any ideas?

    When trying to download an APP, it's requesting setup for answers to 3 security questions and it hangs up the iPad when clicking the drop down for the questions...any ideas?

    Had to do a hard reboot on the iPad and we were able to get the questions to pop up. Now it's just slow downloading the apps.

  • Direct selection tool won't show the handles when clicking the path.

    When I draw a line, no matter if it's done with pen, pencil or brush tool, and try to select a point with the direct selection tool, it won't make a selection, I can't get the handles activated. They don't show at all. It only shows the line transform handle. This happens only in one certain file. When I open a different file or create a new one, the problem doesn't exist.

    Acca,
    Ctrl/Cmd+H.
    It toggles View>Show/Hide Edges.
    The key combination Ctrl/Cmd+H is the most vulnerable one, completely surrounded by other key combinations all only waiting to wreck things when you look the other way. Or you may have tried to use one of them, then just (thought you) repeated it when it (seemingly) failed to work the first time.

  • How to enlarge the image when the mouse is clicked

    I want to enlarge the image when the user click the image. How to do it by muse? Thank You!!!

    Hi,
    When you create a page in Muse called "Home" or "Gallery" or other else, when you export your site as HTML you must have a file called "home.html", "gallery.html" or "other else.html". Remember in what page you putted the Gallery in Muse and edit it with notepad, wordpad or similar and find the code where the gallery is linked (search the name of one of your images, is the best way to find it) and replace the code with something similar like that:
    <code>
    <a href="images/medidas06.jpg" rel="lightbox[gallery]"><img class="block ImageInclude" id="u3527_img" data-src="images/medidas06.jpg" src="images/blank.gif" alt="" data-width="248" data-height="360"/> </a>
    </code>
    The path to the JPG files must be ok with your website.
    The other steps are well explained by the readme of the lightbox library
    Regards

  • How to make my "notepad-program" clean the textarea when clicking on "ny"

    Hi!
    I'm having a problem cleaning the textarea when clicking on "ny" (new) in the menubar. What am I doing wrong? Could someone help me solve this problem?
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class AnteckningsProgram
                        implements ActionListener{     
              static JFrame frame;
              static JTextArea textArea;
         public void skapaVisaGUI () {
              frame = new JFrame ("Anteckningsprogram");
             frame.setSize (340, 240);
             frame.setVisible (true);
             frame.setTitle ("Ra Anteckningsprogram");
             Toolkit          tk = Toolkit.getDefaultToolkit ();
             Image      bild = tk.getImage("r.png");
             frame.setIconImage(bild);
              JTextArea textArea = new JTextArea ();
             frame.add (textArea, "Center");
             JMenuBar cm = createMenuBar();       
             //frame.add(cm, BorderLayout.NORTH);     
             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public     JMenuBar     createMenuBar () {
              JMenuBar     menyBar;
              JMenu          meny;
              JMenuItem     oppna;
              JMenuItem     quit;
              JMenuItem     ny;
              menyBar = new JMenuBar ();
              JMenu arkiv = new JMenu("Arkiv");
              oppna = new JMenuItem ("Oppna");
              quit = new JMenuItem("Quit");
              ny = new JMenuItem("Ny");
              ny.setActionCommand("Ny");
              ny.addActionListener(this);
              quit.setActionCommand("Quit");
              quit.addActionListener(this);
              //arkiv.setMnemonic(KeyEvent.VK_U);
              arkiv.add(oppna);
              arkiv.addSeparator();
              arkiv.add(quit);
              arkiv.addSeparator();
              arkiv.add(ny);
              menyBar.add(arkiv);
              frame.setJMenuBar(menyBar);     
              return menyBar;     
         public void actionPerformed(ActionEvent e) {
             if ("Ny".equals(e.getActionCommand())) {
                      createTextArea();
                 //annars går vi vidare till metoden quit
                 else {
                     quit();
         protected void quit() {
                 System.exit(0);
         protected void createTextArea() {
              JTextArea textArea = new JTextArea ();
              textArea.setText("fdfdsfdfsdf");
          public static void main(String[] args) {
                  //anroppar metoden createandshowGUI
                  AnteckningsProgram ap = new AnteckningsProgram();
                  ap.skapaVisaGUI();
    }

    The basic problem here is 'scope'. The scope of an attribute is 'Java 101' by the way. I recommend you start on the basics *(<- link)* and leave GUIs aside for a while.

  • PDF stored in database and to view the PDF when clicking on a link

    Is it possible to save a PDF document in the database as a blob column and to retrieve the PDF when clicking on the link
    Example
    Above method is possible for images
    See: http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm.
    But can I reach the same for PDF documents?
    Thanks in advance for your response.
    Kind regards,
    Iloon

    Hello Andy,
    This Upload and Download Files is very useful feature in APEX.
    However, is there a way of displaying PDF files first in the report by clicking the corresponding link
    in the table?
    I mean, is it possible to view PDF files first by clicking the link before deciding to download them?
    As we see, this approach is used by most websites and after opening and viewing a PDF file, we can save them.
    Thanks.
    Shurick.
    Edited by: Shurick on Sep 28, 2009 12:51 PM

  • Firefox loads, icon is on task bar but when clicked the graphics slide off to the right but don't fill the screen & when clicked again, falls back into the icon

    Firefox, Thunderbird & Quicken were active when I loadad & ran a slot machine game. When I exited the game & clicked the icon to return Firefox to full screen, I could see the image flash off to the right side of my monitor screen and disappear. When I again clicked on the icon in the task bar, the reverse happened- the image flashed from the right down to the icon. When I hover the mouse pointer over the icon, the open screens show up with the red X to close but the same thing happens when I click on that box. The other two programs that were open while the game was active are working fine, only Firefox has been affected. I cannot open the program to access any of the menu items as I cannot get the screen image on the monitor. I did uninstall the program and reinstall a freshly downloaded copy I had to use IE, as I am now) but with the same results when I run it. I did chose to save my settings so if something has been changed there then that might be the problem.

    Hello,
    '''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
    ''(If you're not using it, switch to the Default theme.)''
    * You can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
    Thank you.

  • When making a photo book in Aperture. How do you eliminate having the image numbers under the pictures?

    When making a photo book in Aperture. How do you eliminate having the image numbers under the pictures?

    Click the "Book Actions" cogwheel and select "Page Numbers " -> "Off"
    Regards
    Léonie

  • How to keep the image centered in the window when mouse zooming in cc 2014

    I,m not able to keep the image centered in the window when using the mouse scroll wheel for zooming.

    Ctrl + and - keys are meant for "center zoom".  As far as I know, the zoom tool is a "point zoom" tool. If you move the zoom tool with your mouse, it will zoom in on that part of the image.
    Also Ctrl 0 is "fit to screen" and Ctrl 1 is 100% zoom. (Use Cmd if this is a Mac)
    Gene

  • Photos in album are only a hash-marked outline the image only shows when scrolling how can I see the image and open the photo?

    Photos in iPhoto album are only a hash-marked outline the image only shows when scrolling how can I see the image and open the photo?

    Make a temporary, backup copy (if you don't already have a backup copy) of the library and apply the two fixes below in order as needed:
    Fix #1
    Launch iPhoto with the Command+Option keys held down and rebuild the library.
    Select the options identified in the screenshot. 
    Fix #2
    Using iPhoto Library Manager  to Rebuild Your iPhoto Library
    Download iPhoto Library Manager and launch.
    Click on the Add Library button, navigate to your Home/Pictures folder and select your iPhoto Library folder.
    Now that the library is listed in the left hand pane of iPLM, click on your library and go to the File ➙ Rebuild Library menu option
    In the next  window name the new library and select the location you want it to be placed.
    Click on the Create button.
    Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments but not books, calendars or slideshows. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
    OT

  • I am using adobe photoshop cs6. I am facing a problem. When i save any image as "save for web". After saving image it show cropped. An image show many parts of the image after saving the image. Please help me. Thanks in advance.

    I am using adobe photoshop cs6. I am facing a problem. When i save any image as "save for web". After saving image it show cropped. An image show many parts of the image after saving the image. Please help me. Thanks in advance.

    Just go back in photoshop and use the Slice Select tool, then just click and select the slice and hit delete - if you're not sure which one is the active slice just right click and find the one that has the Delete Slice option.
    It's possible you either added the slices by accident or if you received it from someone they just had the slices hidden. For the future, you can go to View > Show > Slices to display (or hide) slices.

  • I want to do banners ,how can we do  when click the same button (next button)  it must show differen

    i want to do banners ,how can we do  when click the same button (next button)  it must show different images . cam any one help

    Check out my blog with samples on Edgehero.
    http://www.edgehero.com/articles/interactivity

  • I have installed iOS7 on my iPhone4. I am able to add/edit contacts by clicking the "contact" icon. But when I am trying to do the same after clicking the "phone" icon, it is not displaying the keypad. I believe it is a bug in iOS7. Please confirm. iPhone

    I have installed iOS7 on my iPhone4. I am able to add/edit contacts by clicking the "contact" icon. But when I am trying to do the same after clicking the "phone" icon, it is not displaying the keypad. I believe it is a bug in iOS7.
    Please confirm.
    iPhone 4, iOS 7

    Hello jayanand,
    You may need to force close all open apps, then restart the phone. If necessary, you may need to reset the phone after that.
    iOS: Force an app to close
    http://support.apple.com/kb/HT5137
    iPhone, iPad, iPod touch: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/HT1430
    Cheers,
    Allen

  • My mac will not show images when on the internet?

    My mac will not show images when on the internet?  I think I have inadvertently changed some settings but nor sure which one.

    I am going to assume you are using Safari here. If so then go to the Apple menu bar and hit Safari-> Preferences.  Under the Apperance tab there is a check box that is called "Display images when the page opens".  Check if that is unticked.

  • PC/64/Windows 7/XIStandard recently installed/unable to put footer into document because I can't move to the bottom of the image when in footer application mode.  Display is at recommended 1920x1080.  Is there a solution or is it a flaw in the program?

    PC/64/Windows 7/XIStandard recently installed/unable to put footer into document because I can't move to the bottom of the image when in footer application mode.  Display is at recommended 1920x1080.  Is there a solution or is it a flaw in the program?

    Don't have a direct answer. But did you install the updates. They might resolve the problem.

Maybe you are looking for

  • Printing from LCD-Form in Adobe Reader 9 - Fonts-Problem

    hey there, I posted this in Adobe Reader forum, but probab. its better here... HELP PLS! I have a strange problem.I created a form in Adobe Live Cycle Designer and use this in an Adobe-PDF-package. By printing it on another PC (Windows) the fonts did

  • Zooming in photo viewer...?

    please could you tell me if it exists the function to zoom into an image in the photo viewer app, i've tried different things and cant get it to work like it does in internet browser. very frustrated...! thank you in advance

  • HT2729 I bought my iPad in America. Now living in Germany and cannot access iTunes???

    I bought my iPad in America. Now living in Germany and cannot access iTunes???

  • CS4 Printing problem with RGB

    When I try to print an 8x10 image using the default RGB color, I get a vertical band about 2 inches wide along the left side or bottom of the document, depending on orientation. This band looks as though there were a filter over that portion of the i

  • Gps and nokia drive

    Hi, i have the new Nokia lumia why is necessary to have data connection to use Nokia drive? I this phone have a god why doesn't work with it. I had a Nokia x6 and Nokia maps it worked perfectly.could you make that Nokia drive works only with god and