Quantunet.com

My Account

Joins Us
Flash 8 Actionscript 2.0 QuickSkills

Creating An Interactive X-ray Effect

 

How to create a draggable lens:

  • Select the first frame of the "image" layer.
  • Open the library panel and drag the movie clip "pic" onto the stage.
  • Center the movie clip on stage using the align panel.
  • Select the first frame of the "image" layer.
  • Then in the tools panel:
    • Select the "Rectangle" tool.
    • Click on the "Set Corner Radius" icon.
    • In the "Rectangle Settings" window:
      • Set the corner radius to "10".
      • Press the "OK" button.
  • In the properties panel:
    • Set the fill color to "#FFFFFF".
    • Set the stroke color to "none".
  • On stage press and hold down the left mouse button then drag the cursor to create a rectangle.
  • Select the fill then in the main menu go to Modify > Convert to Symbol.
  • In the "Convert to symbol" window:
    • Set the type to "Movie Clip".
    • Set the name to "lens_mc".
    • Press the "OK" button.
  • In the properties panel:
    • Set the instance name to "lens_mc".
    • Set the "Blend" to "Invert".
  • Then in the main timeline select the first frame of the "actions" layer.
  • Open "actions" panel enter the following script:

lens_mc.onPress = function(){
this.startDrag();
}
lens_mc.onRelease = function(){
this.stopDrag();
}
lens_mc.onReleaseOutside = function(){
this.stopDrag();
}

  • Then in the main menu go to Control > Test Movie.
 

Note: To learn more about working with the cursor in actionscript see [Mouse ActionScript Knowledgebase].

© 2007 Quantunet LLC All Rights Reserved | Intellectual Property | Terms of Use | Privacy
Home | About Quantunet | FAQ's | Contact Us