Part 1: Build and Interactive Map with Flash / AS3

by carl schooff on November 4, 2010 · View Comments

in GreenSock Tweening Platform Tips

This movie requires Flash Player 9

Here we go again. This tutorial will walk you through building a little map with some cool effects and awesome flexibility. I created this tutorial to really show you how much better your projects can be with a little AS3 and TweenLite love. This video will also highlight the limitations to my previous map tutorial that contained no ActionScript. Check it out.

Benefits of Adding a Little ActionScript 3

  • Easily modify the scale and position of individual map elements
  • Move the descriptive text whereever you want
  • Change the mouseOver and mouseOut colors for all elements with one easy change
  • Limitless possibilities for easily modifying the text animation

Stay Tuned!

Be sure to stick around for part 2 where I clean things up even more and show you how to completely avoid putting any of the descriptive text into a movie clip timeline. Good stuff!

ActionScript 3.0 Code Used in this Tutorial

import com.greensock.*;

map_mc.buttonMode=true;

map_mc.addEventListener(MouseEvent.MOUSE_OVER, mapOver);
map_mc.addEventListener(MouseEvent.MOUSE_OUT, mapOut);

function mapOver(e:MouseEvent):void{
	var mapItem:MovieClip = e.target as MovieClip;
	description.gotoAndStop(mapItem.name);
	TweenMax.to(mapItem, .5, {tint:0xFF9900});
	TweenMax.fromTo(description, .5, {alpha:0, x:50, blurFilter:{blurX:80}}, {alpha:1, x:10, blurFilter:{blurX:0}});
	}

function mapOut(e:MouseEvent):void{
	var mapItem:MovieClip = e.target as MovieClip;
	TweenMax.to(mapItem, .5, {tint:0x990000});
	}

Download Source Files

SNORKLTV_mapFIles_cs3

Part 2 Just Launched

Check out how to use a dynamic textfield instead of putting description text into a movie clip with individual keyframes and labels Interactive Map Part 2

Post to Twitter Post to Facebook

  • http://www.snorkl.tv/2010/07/learn-how-to-make-an-easy-interactive-map-with-flash-no-actionscript/ Learn How To Make An Easy Interactive Map with Flash: No ActionScript

    [...] you want to take your maps to the next level, be sure to watch my new tutorial Build a Map with ActionScript. This new video tells shows you how to add just a little AS3 and avoid all the potential problems [...]

  • http://djgirish.com DJ Girish Khatiwada

    Nice tutorial on how to effectively use both frames and actionScript.

  • Antoniofrod

    Nice tutorial but how can i link does buttons to an Link? I've searched all over the net i can make a MC work to a link but in this specific way i can't find a way to do it. I'm really would like to know how could this be possible.

    Ps: Thanks for all the tutorials i've learned some cool stuff with you

  • Antoniofrod

    I've found the problem it's solved other question is there a way to tint the fill and the stroke separately

  • http://www.snorkl.tv/ carl schooff

    cool. glad you found the problem and it is solved. I will most likely add the linking functionality soon and do another video.

    for the fill and stroke:
    For each movie clip in your map create a stroke and fill movie clip. Apply the instance names stroke_mc and fill_mc.

    on the mapOver function add the following:

    TweenMax.to(mapItem.stroke_mc, .5, {tint:0xFF0000});
    TweenMax.to(mapItem.fill_mc, .5, {tint:0x00FF00});

    for each item in your map you may have to add the following at the top of the script (outside any functions)

    nav_mc.someCountry_mc.mouseChildren=false;
    nav_mc.someOtherCountry_mc.mouseChildren=false;
    nav_mc.someOtherCountryInstanceName_mc.mouseChildren=false;

    I may just make a part 3 tutorial as these are pretty cool features that you requested. I regret that I am a bit busy with work so I don't know when I can promise it by.

    thanks for watching!
    -c

  • kutson

    Thank you very much Carl for your great tutorials im a new fan

    Its awesome to have people like you in this indestry to help every one grow and produce better work

    Cheers mate you are a true star

  • http://www.snorkl.tv/ carl schooff

    Yo Kutson. Thanks for dropping in. I've benefitted so much from others in

    the community. Just starting to do my part and give a little back. Look

    forward to seeing you around.

    -Carl

  • http://twitter.com/procastino tucho mendez

    Hi Carl!
    You’ve just saved my life, I was trying to do almost exactly this thing, but it wasn’t until I watched your tutorial that I really learned how to do it. Pity it was after 5 hours of googling and scratching my head!
    Thank you soooooooooooooooo much!!

  • http://www.snorkl.tv/ carl schooff

    Always great to hear these reports. Thx for taking the time to comment.

    Catch you around.

    Carl

  • Joel

    Thanks for the tutorial I got to use this on a project for work and ran into a problem..have you ever tried to trace a MC name and never got one back? I had our Graphic Designer export from Indesign her work but as a FLA an for a weird reason I cant trace  some of the MC’s names back im getting nothing back …maybe something to do with how Indesign exports their layers?

         I did delete afew weird duplicate instances in my library that came in from importing the FLA an I did get a trace on that particular image..Have you ever ran into something like this? I feel close to solving issue.Great tutorial again hope all is well.

  • Joel

    Thanks for the tutorial I got to use this on a project for work and ran into a problem..have you ever tried to trace a MC name and never got one back? I had our Graphic Designer export from Indesign her work but as a FLA an for a weird reason I cant trace  some of the MC’s names back im getting nothing back …maybe something to do with how Indesign exports their layers?

         I did delete afew weird duplicate instances in my library that came in from importing the FLA an I did get a trace on that particular image..Have you ever ran into something like this? I feel close to solving issue.Great tutorial again hope all is well.

  • Joel

    Thanks for the tutorial I got to use this on a project for work and ran into a problem..have you ever tried to trace a MC name and never got one back? I had our Graphic Designer export from Indesign her work but as a FLA an for a weird reason I cant trace  some of the MC’s names back im getting nothing back …maybe something to do with how Indesign exports their layers?

         I did delete afew weird duplicate instances in my library that came in from importing the FLA an I did get a trace on that particular image..Have you ever ran into something like this? I feel close to solving issue.Great tutorial again hope all is well.

  • Joel

    well the reason I was not able to trace my mc’s is because its being blocked by other mc’s that are I set their alpha to 0%..

blog comments powered by Disqus

Previous post:

Next post: