Hide Old and Reveal New Script
Posted by Helmut Granda | Filed under ActionScript, Programming
I was talking the other day with a friend about a small challenge, having 2 images on stage with 2 ideas. 1- have the experience being user driven (in this case the mouse reveals one image while hiding the other) 2- Use XML for easy update. So we fired flash and the above is the visual and the code below...
- var xmlLoader:XML = new XML();
var firstItem:String;
var secondItem:String;
xmlLoader.ignoreWhite = true;
xmlLoader.onLoad = function ( success )
{
var base = xmlLoader.firstChild;
firstItem = base.firstChild.firstChild.firstChild
secondItem = base.firstChild.firstChild.nextSibling.firstChild
firstItem = "images/" + firstItem.toString();
secondItem = "images/" + secondItem.toString();
setImages();
}
xmlLoader.load("xml/revealer.xml");
Mouse.addListener(this);
onMouseMove = function()
{
mask1_mc._x = _root._xmouse;
}
function setImages()
{
var mcl1:MovieClipLoader = new MovieClipLoader();
mcl1.addListener(this);
mcl1.loadClip(firstItem, image1_mc);
var mcl2:MovieClipLoader = new MovieClipLoader();
mcl2.addListener(this);
mcl2.loadClip(secondItem, image2_mc);
}
mask1_mc._x = 212;
2 Responses to “Hide Old and Reveal New Script”
-
Gadgets » Hide Old and Reveal New Script Says:
September 21st, 2007 at 4:30 pm<p>[...] Helmut wrote an interesting post today!.Here’s a quick excerptI was talking the other day with a friend about a small challenge, having 2 images on stage with 2 ideas. 1- have the experience being user driven (in this case the mouse reveals one image while hiding the other) 2- Use XML for easy … [...]</p>
-
anthony Says:
September 12th, 2008 at 7:39 pmi’ve been searching 4 ever and i finally found this script im new to flash do u have a downloadable fla that i could to build on. id gladly share my results. i just need to something to start with. im trying to build an on line art website
thank you