Hide Old and Reveal New Script
Posted by Helmut | Filed under Flash Bits, Tutorials
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;
One Response 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>