• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 112
  • Last Modified:

as3 script to jump between swfs

can I see an example of a button script that opens a new movie from another movie?
0
mikelly3614
Asked:
mikelly3614
  • 2
1 Solution
 
mikelly3614Author Commented:
okay I got that part:
button_mc.addEventListener(MouseEvent.MOUSE_DOWN,addCroc);

function addCroc(event:MouseEvent):void;{
var ld:Loader = new Loader()
ld.load(new URLRequest("croc.swf"))
addChild(ld)}

how might a second button remove the crocs one at a time?

thanks,
Mike
0
 
FlyingFlashCommented:

button_mc.addEventListener(MouseEvent.MOUSE_DOWN,addCroc);
button_mc2.addEventListener(MouseEvent.MOUSE_DOWN,removeCroc);
 
var crocs:Array = new Array();
 
function addCroc(event:MouseEvent):void
{
	var ld:Loader = new Loader()
	ld.load(new URLRequest("testslide.swf"))
	addChild(ld)
	crocs.push(ld);
}
 
function removeCroc(event:MouseEvent):void
{
	if (crocs.length>0){
		crocs[crocs.length-1].unload();
		crocs.pop();
	}
}

Open in new window

0
 
FlyingFlashCommented:
Sorry .. I changed the name of the swf for testing .. don't forget to change it back to croc.swf :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now