Posts tagged ‘AS3’

June 4th, 2010

Tips for code hints in Flash CS5

by Jen deHaan

There are a number of forum posts about code hinting not showing up as expected in Flash CS5 documents. There are a number of possibilities about why code hints do not show up, but the following post will collect some troubleshooting tips that may help you out.

July 24th, 2009

Controlling the window target a button click opens using ActionScript 3.0 in Flash

by Jen deHaan

One of my frequently asked questions in the comments is how to control what window a button click opens using ActionScript 3.0. For example, you might want your button to open in the same window, a particular part of your frames layout, or a new window. It’s similar to ActionScript 2.0, but there is a bit of a difference.

In ActionScript 2.0, you set a target for your button using code such as the following:

The following steps for ActionScript 3.0 will apply to either Flash CS3 or Flash CS4, just make sure that your document is an ActionScript 3.0 button and you’re adding the code to a frame.

  1. Create your button in your FLA, and give it an instance name in the Property inspector, such as my_btn.
  2. Select a frame on the timeline at the same frame number of your button.
  3. Open the Actions panel, and add the following code:
    my_btn.addEventListener(MouseEvent.MOUSE_DOWN, myHandler);
    function myHandler(event:MouseEvent):void {
        navigateToURL(new URLRequest("http://www.adobe.com/devnet/flash/"), "_self");
    }
  4. Publish preview your work in HTML (File > Publish Preview > HTML). Note: When testing locally, you will need to set your security to allow access to the SWF. If you haven’t set this up, click Settings in the dialog that opens when you first test your FLA, select a directory on your hard drive, and save the FLA to that same directory and test again.
  5. By default, without adding this parameter, ActionScript assumes _blank which opens a new window. You can modify the _self in the code above to be _top or _parent (or _blank if you want). Here’s what each of them does:

    • _self opens the link in the current frame of the current browser window.
    • _blank opens the link in a new window (or tab if that’s what the user has their browser set to do).
    • _parent opens the link in the parent of the current frame.
    • _top opens the link in the top-level frame of the current browser window.

December 10th, 2008

Flash CS4 example: Spray Brush, Tween instance, new motion, AS3, fancy JSFL… Profit!

by Jen deHaan

In the previous blog entry, I linked to a new JSFL that automatically gives instance names to selected instances in a smart way. You can go read about and download the JSFL from this page. This entry shows you how to use this command along with some of the new features in Flash CS4.

September 4th, 2008

(Flash CS3) Masking using ‘donut’ shapes within movie clips or with AS3 – it’s possible, and not too bad either

by Jen deHaan

You may have tried creating a shape that has a hole in it for a mask in Flash, and it may not have worked. Or maybe it did work and sometimes it didn’t, and you grew some extra gray hairs and threw your laptop at a wall. Or maybe you’re thinking “what the hell is she talking about now?”. I’ll start from (almost) the beginning [if you're not sure about making masks in Flash, read this super old tech support article.. it hasn't changed].

More after the jump.