XML Driven rotating banner ad question

Hi everyone i a very ametur flash designer,
At the moment i am trying to make a flash banner that rotates banners out randomly and also when the guest sees the a banner they are intrested in they can click on it and it will take them to the respective link. I followed some tutorials out there on how to use xml and flash together and came up with this for my flash code:
// set random # variables - each must be 0 for first 'while' loop below
var randomNum = 0;
var randomNumLast = 0;
// parent container
var container_mc = this.createEmptyMovieClip("container",0);
// movie clip containers
container_mc.createEmptyMovieClip("loader1_mc",2);
container_mc.createEmptyMovieClip("loader2_mc",1);
// preload watcher
this.createEmptyMovieClip("watcher_mc",100);
// load xml
images_xml = new XML();
images_xml.ignoreWhite=true;
images_xml.onLoad = parse;
images_xml.load("images.xml");
function parse(success) {
    if (success) {
        imageArray = new Array();
        var root = this.firstChild;
        _global.numPause = Number(this.firstChild.attributes.timer * 1000);
        _global.order = this.firstChild.attributes.order;
        _global.looping = this.firstChild.attributes.looping;
        _global.fadetime = Number(this.firstChild.attributes.fadetime);
        _global.xpos = Number(this.firstChild.attributes.xpos);
        _global.ypos = Number(this.firstChild.attributes.ypos);
        var imageNode = root.lastChild;
        var s=0;
        while (imageNode.nodeName != null) {
            imageData = new Object;
            imageData.path = imageNode.attributes.path;
            imageArray[s]=imageData;
            imageNode = imageNode.previousSibling;
            s++;
        // place parent container
        container_mc._x = _global.xpos;
        container_mc._y = _global.ypos;
        // parse array
        imageArray.reverse();
        imageGen(imageArray);
    } else {
        trace('problem');
// depth swapping
function swapPlace(clip,num) {
    eval(clip).swapDepths(eval("container_mc.loader"+num+"_mc"));
function loadImages(data,num) {
    if (i==undefined || i == 2) {
        i=2;
        createLoader(i,data,num);
        i=1;
    } else if (i==1) {
        createLoader(i,data,num);
        i=2;
function createLoader(i,data,num) {
    thisLoader=eval("container_mc.loader"+i+"_mc");
    thisLoader._alpha=0;
    thisLoader.loadMovie(data[num].path);
    watcher_mc.onEnterFrame=function () {
        var picLoaded = thisLoader.getBytesLoaded();
        var picBytes = thisLoader.getBytesTotal();
        if (isNaN(picBytes) || picBytes < 4) {
            return;
        if (picLoaded / picBytes >= 1) {
            swapPlace("container_mc.loader2_mc",1);
            alphaTween = new mx.transitions.Tween(thisLoader, "_alpha", mx.transitions.easing.Regular.easeOut,0,100,_global.fadetime,true);
            timerInterval = setInterval(imageGen,_global.numPause,data);
            delete this.onEnterFrame;
function imageGen(data) {
    // random, or sequential?
    if (_global.order=="random") {
        // choose random # between 0 and total number of images
        while (randomNum == randomNumLast) {
            randomNum = Math.floor(Math.random() * data.length);
            trace(randomNum);
        loadImages(data,randomNum);
        randomNumLast = randomNum;
    } else if (_global.order=="sequential") {
        // start at 0, increment to total number of images, then drop back to zero when done
        if (p==undefined || p==data.length && _global.looping=="yes") { p=0; } else { break; }
        loadImages(data,p);
        p++;
    } else {
        trace ("order attribute in xml isn't correct - must specify either 'random' or 'sequential'");
    clearInterval(timerInterval);
stop();
XML:
<gallery timer="5" order="random" fadetime="2" looping="yes" xpos="0" ypos="0">
<image path="images/12_02.png" />
<image path="images/600x300callawway_kodak.jpg" />
<image path="images/BurnerBucksTemplate_600x300.jpg" />
<image path="images/DEI-594-X-250-copy.png" />
<image path="images/Wilson_DFY_600X300.jpg" />
<image path="images/sky_golf.jpg" />
</gallery>
Now everything works right so far, my question is how would i make the banners/images into links so when the banner is clicked i can add a link to it so they are taken to that product.

That code does not go on the button like you would do with on(release) code.  That code will go with the rest of the code you showed.  You will assign an instance name to that button... if you use the code I showed, that instance name will be "btn"--you assign it by selecting the button on the stage and entering it into the Properties panel where it says <Instance Name>.  You will also declare the urlVAriable where that code is...
var urlVariable:String;
As for the xml end of things, I will leave you to solve with a little help.  Look at the parse function and try to see how the current xml information is captured and later utilized.   You will essentially create another parameter in each xml node to go with the current "path" parameter.  You can call it "link" or something like that, and it will contain the url that clicking the button will lead to.
<gallery timer="5" order="random" fadetime="2" looping="yes" xpos="0" ypos="0">
<image path="images/12_02.png" link="http://www.somesite.com" />
<image path="....
</gallery>
When you parse the xml you will add the link value as another property of the imageData object that you create.
        while (imageNode.nodeName != null) {
            imageData = new Object;
            imageData.path = imageNode.attributes.path;
            imageData.link = imageNode.attributes.link;
            imageArray[s]=imageData;
            imageNode = imageNode.previousSibling;
            s++;
The rest I will leave for you to sink your teeth into... you need to dig into the code that is used to present the banners and see where assigning the value of the link to the urlVariable needs to happen.

Similar Messages

  • Looking for a non XML driven Flash banner rotator

    I am looking for a non XML driven Flash banner rotator, something where I can load my images into the FLA and publish. The only rotators I can seem to find have external XML/image files, etc.
    All I want to do is create simple SWF's that I can use to display rotating images preferably is a smooth and stylish manner. Does anyone know of any, or could point me in the right direction?
    Many thanks for any help you may be able to offer and I am willing to follow any tutorials.

    Hi
    I wonder why not show you how to use Quicktime.
    Because I would use the html5 audio, that way the browser chooses the 'player' to use, and I wanted to give the OP the choice -
    <audio controls preload="auto" autobuffer>
      <source src="elvis.mp3" />
      <source src="elvis.ogg" />
      <!-- now include flash fall back -->
    </audio>
    PZ

  • Flash Lite XML Driven Gallery Simple Question

    Hello Flash Lite Gurus',
    Someone Named "Mr. Samir K. Dash;" did a wonderful tutorial regarding Flash Lite XML driven Photo Gallery, and I have just a small question:
    1> I changed the attributes schema of the xml as attached and noticed that it is not working, and I wonder what could be the reason (please see the attached XML new attribute schema, I didn't change fields names, I just changed the way the attributes' schema looks like).
    The link to the tutorial is the following:
    http://www.adobe.com/devnet/devices/articles/xml_photo_gallery.html
    Looking forward to your help
    best regards
    Talal

    As I look at your modified XML file, you need to make major changes in the script.
    You have changed the attributes to become child nodes. So, you will need to use firstChild.nodeValue or childNodes[i].nodeValue everywhere.
    Regards,
    Hemanth Sharma
    http://www.flashlitehub.com/blog

  • Importing xml driven swf file -- is it asking for too much?

    I want to import an ActionScript3 / xml driven swf file into Catalist, but it only imports the swf file.
    I have placed all the external images and the xml file that calls them into the same folder as the swf and the catalist files, but the playback still does not work. It shows error messages when trying to run. Copying the files to Assets/ Media  or Images folders also makes no difference...There is no way in Catalyst to reconnect the xml to the swf either...
    Why can't Flash and Catalyst be more friendly? Will there be a better connectivity in the final version?

    Hello there,
    There are several reasons why this wouldn't work, especially during preview. I'd like to ask you a couple questions and have you try a couple things.
    1. What file path are you saving your project to, and what location did you copy the XML and image files to?
    2. Did you try publishing your project, and copying your additional files to the published locations?
    3. Did you try the same steps as above, only using the deploy-to-web version posted on your server? You would load the application by going to your web browser and typing something like: http://yourserverhere.com/.../deploy-to-web/Main.html.
    Let me know if any of those work. Because Catalyst cleans the space where preview files are kept, it would be difficult to have your scenario work during preview. However, you could probably get it to work in a published version.

  • Trying to use a Rotating Banner Script

    Hi All,
    I know that some of you are very well versed in iWeb '08 so I thought my question could be answered here.
    I would like to use a rotating banner script on each of the pages on my iWeb made website on the .mac server. I'm not sure how to do this. The script will rotate 5 pictures. When you load one of the pages a picture will appear on top of the page. When you reload the page, you'll see a different picture.
    What I need to know in order to accomplish this rotation is: 1) Where do I upload the pictures to be used 2)what will the link to the pictures be that I need to insert into the script and 3) How do I get the script onto my webpage?
    Thanks in advance for the help

    Hi iwr,
    I used a little application to make some banners because I cannot (or don't want to) learn code and you can see it here
    http://www.mireillegreen.com/Frenchresources/French_ResourcesMain.html
    the site is far from finished so there are many dead links but the banners work. what the app does is upload the banner on my .mac then I paste the code in the snippet. and the snippet looks for the banner. So if I guess right the important is that you place the banner where you tell your page to look for it regardless of where you place it. If you want to try this app (it's free to try) you can find it here, then you can see how it handles the upload.
    http://www.aquafadas.com/bannerzest/
    Good luck
    Mireille

  • XML Driven Flash Photo Gallery Thumbnails

    Hi,
    I need to make a XML Driven Photo slide in Flash CS5.
    It needs to have a Box that contains 5 Thumbnails(by XML) act as buttons.
    The Box sits on top of the Main photo area and shrinks (or close out) when user click its close button. And it opens out by clicking on a open button.
    I'm sure it can be done by using timeline, Tweening or you name it..But what about the Thumbnails that run from the XML file?
    Can they disappear with the Box and retrieve when it opens? is it possible?
    If yes, what would be the best way to do that?
    Any comment would be greatly appreciated!
    Here is the ActionScript.
    import flash.net.URLRequest;
    import flash.net.URLLoader;
    import flash.events.Event;
    import fl.controls.Button;
    import flash.display.Shape;
    import flash.events.MouseEvent;
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.text.TextField;
    import fl.transitions.*;
    import fl.transitions.easing.*;
    import flash.display.Shader;
    var hasloaded:Boolean = false;
    var firstLoaded:Boolean = false;
    var barWidth:int;
    var barHeight:int;
    var images;
    var imageCount:int;
    var thumbnailArray:Array = new Array();
    var bigImageArray:Array = new Array();
    var descriptionArray:Array = new Array();
    var xmlLoader:URLLoader = new URLLoader();
    var imageXML:XML = new XML();
    xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
    xmlLoader.load(new URLRequest("slideshow.xml"));
    function LoadXML(e:Event):void {
        imageXML = new XML(e.target.data);
        ParseImages(imageXML);
    Populates the arrays with the image values
    and the text for each picture.
    function ParseImages(imageInput:XML):void {
        var iconList:XMLList = imageInput.image.icon;
        var mainImageList:XMLList = imageInput.image.mainimage;
        var descriptionList:XMLList = imageInput.image.description;
        for (var i:int = 0; i < iconList.length(); i++) {
            var imageElement:XML = iconList[i];
            //trace(imageElement);
            thumbnailArray[i] = imageElement;
        for (var j:int = 0; j < mainImageList.length(); j++) {
            var mainimageElement:XML = mainImageList[j];
            //trace(mainimageElement);
            bigImageArray[j] = mainimageElement;
        for (var l:int = 0; l < descriptionList.length(); l++) {
            var descriptionElement:XML = descriptionList[l];
            //trace(descriptionElement);
            descriptionArray[l] = descriptionElement;
        loadImages();
    function loadImages():void{
        trace("inside of loadimages function.");
        trace(thumbnailArray.length);
        for(var i:int=0; i < thumbnailArray.length; i++){
            trace(thumbnailArray[i]);
            populateContainers(thumbnailArray[i], i);
            //populateContainers2();
            trace("Loaded " + thumbnailArray[i]);
    var loader:Loader;
    var xStart = -210;
    var ypos = -34;
    var currentPos = xStart;
    var incrementValue = 66;
    This takes in the name of the image file and
    displays it within the newly created movie clip
    function populateContainers(file:String, pos:int):void{   
        //create a movie clip to hold the image
        var mc:MovieClip = new MovieClip();
        mc.graphics.beginFill(0xFFFFFF);
        mc.graphics.drawRect(0, 0, 50, 51);
        mc.graphics.endFill();
        mc.buttonMode = true;
        mc.x = currentPos;
        mc.y = ypos;
        mc.name = "thumb_" + pos;
        mc.addEventListener(MouseEvent.CLICK, clickHandler); 
        loader = new Loader();
        //loader.mask = imagemask;
        var url:URLRequest = new URLRequest(file);
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadInitialImage);
        loader.load(url);
        //add the image to the movie clip
        mc.addChild(loader);
        this.imageBar.addChild(mc);
        //increment the currentPos
        currentPos += incrementValue;
    function clickHandler(e:MouseEvent):void{
        var str:String = e.currentTarget.name;
        var index:int = int(str.substr(6,1));
        if(hasloaded) {
            this.mainWindow.removeChild(loader);
        loader = new Loader();
        loader.load(new URLRequest(bigImageArray[index]));
        this.mainWindow.addChild(loader);
        TransitionManager.start(this.mainWindow,{type:Fade, direction:Transition.IN, duration:2, easing:Regular.easeOut});
        //setChildIndex(loader, 0);
        hasloaded = true;
        loadText(index);
    function loadText(index:int):void {
        Object(this).imageBar.txtdescription.text = descriptionArray[index];
    function loadInitialImage(event:Event):void {
        if(!firstLoaded) {
            loader = new Loader();
            loader.load(new URLRequest(bigImageArray[0]));
            this.mainWindow.addChild(loader);
            TransitionManager.start(this.mainWindow,{type:Fade, direction:Transition.IN, duration:2, easing:Regular.easeIn});
            //setChildIndex(loader, 0);
            hasloaded = true;
            loadText(0);
        firstLoaded = true;
    /*  This section defines the buttons that control the image bar */
    Object(this).imageBar.btnBarOpen.addEventListener(MouseEvent.MOUSE_UP, openImageBar);
    function openImageBar(event:MouseEvent):void {
        this.gotoAndPlay(1);

    thank you!

  • XML Driven Flash Photo Gallery Thumbnails Control

    Hi, I need to make a XML Driven Photo slide in Flash CS5.
    It needs to have a Box that contains 5 Thumbnails(by XML) act as buttons.
    The Box sits on top of the Main photo area and shrinks (or close out) when user click its close button. And it opens out by clicking on a open button.
    I'm sure it can be done by using timeline, Tweening or you name it..But what about the Thumbnails that run from the XML file?
    Can they disappear with the Box and retrieve when it opens? is it possible?
    If yes, what would be the best way to do that?
    Any comment would be greatly appreciated!
    Here is the ActionScript.
    import flash.net.URLRequest;
    import flash.net.URLLoader;
    import flash.events.Event;
    import fl.controls.Button;
    import flash.display.Shape;
    import flash.events.MouseEvent;
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.text.TextField;
    import fl.transitions.*;
    import fl.transitions.easing.*;
    import flash.display.Shader;
    var hasloaded:Boolean = false;
    var firstLoaded:Boolean = false;
    var barWidth:int;
    var barHeight:int;
    var images;
    var imageCount:int;
    var thumbnailArray:Array = new Array();
    var bigImageArray:Array = new Array();
    var descriptionArray:Array = new Array();
    var xmlLoader:URLLoader = new URLLoader();
    var imageXML:XML = new XML();
    xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
    xmlLoader.load(new URLRequest("slideshow.xml"));
    function LoadXML(e:Event):void {
        imageXML = new XML(e.target.data);
        ParseImages(imageXML);
    Populates the arrays with the image values
    and the text for each picture.
    function ParseImages(imageInput:XML):void {
        var iconList:XMLList = imageInput.image.icon;
        var mainImageList:XMLList = imageInput.image.mainimage;
        var descriptionList:XMLList = imageInput.image.description;
        for (var i:int = 0; i < iconList.length(); i++) {
            var imageElement:XML = iconList[i];
            //trace(imageElement);
            thumbnailArray[i] = imageElement;
        for (var j:int = 0; j < mainImageList.length(); j++) {
            var mainimageElement:XML = mainImageList[j];
            //trace(mainimageElement);
            bigImageArray[j] = mainimageElement;
        for (var l:int = 0; l < descriptionList.length(); l++) {
            var descriptionElement:XML = descriptionList[l];
            //trace(descriptionElement);
            descriptionArray[l] = descriptionElement;
        loadImages();
    function loadImages():void{
        trace("inside of loadimages function.");
        trace(thumbnailArray.length);
        for(var i:int=0; i < thumbnailArray.length; i++){
            trace(thumbnailArray[i]);
            populateContainers(thumbnailArray[i], i);
            //populateContainers2();
            trace("Loaded " + thumbnailArray[i]);
    var loader:Loader;
    var xStart = -210;
    var ypos = -34;
    var currentPos = xStart;
    var incrementValue = 66;
    This takes in the name of the image file and
    displays it within the newly created movie clip
    function populateContainers(file:String, pos:int):void{ 
        //create a movie clip to hold the image
        var mc:MovieClip = new MovieClip();
        mc.graphics.beginFill(0xFFFFFF);
        mc.graphics.drawRect(0, 0, 50, 51);
        mc.graphics.endFill();
        mc.buttonMode = true;
        mc.x = currentPos;
        mc.y = ypos;
        mc.name = "thumb_" + pos;
        mc.addEventListener(MouseEvent.CLICK, clickHandler);
        loader = new Loader();
        //loader.mask = imagemask;
        var url:URLRequest = new URLRequest(file);
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadInitialImage);
        loader.load(url);
        //add the image to the movie clip
        mc.addChild(loader);
        this.imageBar.addChild(mc);
        //increment the currentPos
        currentPos += incrementValue;
    function clickHandler(e:MouseEvent):void{
        var str:String = e.currentTarget.name;
        var index:int = int(str.substr(6,1));
        if(hasloaded) {
            this.mainWindow.removeChild(loader);
        loader = new Loader();
        loader.load(new URLRequest(bigImageArray[index]));
        this.mainWindow.addChild(loader);
        TransitionManager.start(this.mainWindow,{type:Fade, direction:Transition.IN, duration:2, easing:Regular.easeOut});
        //setChildIndex(loader, 0);
        hasloaded = true;
        loadText(index);
    function loadText(index:int):void {
        Object(this).imageBar.txtdescription.text = descriptionArray[index];
    function loadInitialImage(event:Event):void {
        if(!firstLoaded) {
            loader = new Loader();
            loader.load(new URLRequest(bigImageArray[0]));
            this.mainWindow.addChild(loader);
            TransitionManager.start(this.mainWindow,{type:Fade, direction:Transition.IN, duration:2, easing:Regular.easeIn});
            //setChildIndex(loader, 0);
            hasloaded = true;
            loadText(0);
        firstLoaded = true;
    /*  This section defines the buttons that control the image bar */
    Object(this).imageBar.btnBarOpen.addEventListener(MouseEvent.MOUSE_UP, openImageBar);
    function openImageBar(event:MouseEvent):void {
        this.gotoAndPlay(1);

    thank you!

  • XML Driven Photo Gallery (Action Script Help)

    Hi,
    I need to make a XML Driven Photo slide in Flash CS5.
    It needs to have a Box that contains 5 Thumbnails(by XML) act as buttons.
    The  Box sits on top of the Main photo area and shrinks (or close out) when  user click its close button. And it opens out by clicking on a open  button.
    I'm sure it can be done by using timeline, Tweening or you name it..But what about the Thumbnails that run from the XML file?
    Can they disappear with the Box and retrieve when it opens? is it possible?
    If yes, what would be the best way to do that?
    Any comment would be greatly appreciated!
    Here is the ActionScript.
    import flash.net.URLRequest;
    import flash.net.URLLoader;
    import flash.events.Event;
    import fl.controls.Button;
    import flash.display.Shape;
    import flash.events.MouseEvent;
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.text.TextField;
    import fl.transitions.*;
    import fl.transitions.easing.*;
    import flash.display.Shader;
    var hasloaded:Boolean = false;
    var firstLoaded:Boolean = false;
    var barWidth:int;
    var barHeight:int;
    var images;
    var imageCount:int;
    var thumbnailArray:Array = new Array();
    var bigImageArray:Array = new Array();
    var descriptionArray:Array = new Array();
    var xmlLoader:URLLoader = new URLLoader();
    var imageXML:XML = new XML();
    xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
    xmlLoader.load(new URLRequest("slideshow.xml"));
    function LoadXML(e:Event):void {
         imageXML = new XML(e.target.data);
         ParseImages(imageXML);
      Populates the arrays with the image values
      and the text for each picture.
    function ParseImages(imageInput:XML):void {
         var iconList:XMLList = imageInput.image.icon;
         var mainImageList:XMLList = imageInput.image.mainimage;
         var descriptionList:XMLList = imageInput.image.description;
         for (var i:int = 0; i < iconList.length(); i++) {
             var imageElement:XML = iconList[i];
             //trace(imageElement);
             thumbnailArray[i] = imageElement;
         for (var j:int = 0; j < mainImageList.length(); j++) {
             var mainimageElement:XML = mainImageList[j];
             //trace(mainimageElement);
             bigImageArray[j] = mainimageElement;
         for (var l:int = 0; l < descriptionList.length(); l++) {
             var descriptionElement:XML = descriptionList[l];
             //trace(descriptionElement);
             descriptionArray[l] = descriptionElement;
         loadImages();
    function loadImages():void{
         trace("inside of loadimages function.");
         trace(thumbnailArray.length);
         for(var i:int=0; i < thumbnailArray.length; i++){
             trace(thumbnailArray[i]);
             populateContainers(thumbnailArray[i], i);
             //populateContainers2();
             trace("Loaded " + thumbnailArray[i]);
    var loader:Loader;
    var xStart = -210;
    var ypos = -34;
    var currentPos = xStart;
    var incrementValue = 66;
      This takes in the name of the image file and
      displays it within the newly created movie clip
    function populateContainers(file:String, pos:int):void{   
         //create a movie clip to hold the image
         var mc:MovieClip = new MovieClip();
         mc.graphics.beginFill(0xFFFFFF);
         mc.graphics.drawRect(0, 0, 50, 51);
         mc.graphics.endFill();
         mc.buttonMode = true;
         mc.x = currentPos;
         mc.y = ypos;
         mc.name = "thumb_" + pos;
         mc.addEventListener(MouseEvent.CLICK, clickHandler); 
         loader = new Loader();
         //loader.mask = imagemask;
        var url:URLRequest = new URLRequest(file);
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadInitialImage);
         loader.load(url);
         //add the image to the movie clip
         mc.addChild(loader);
         this.imageBar.addChild(mc);
         //increment the currentPos
         currentPos += incrementValue;
    function clickHandler(e:MouseEvent):void{
         var str:String = e.currentTarget.name;
         var index:int = int(str.substr(6,1));
         if(hasloaded) {
             this.mainWindow.removeChild(loader);
         loader = new Loader();
         loader.load(new URLRequest(bigImageArray[index]));
         this.mainWindow.addChild(loader);
         TransitionManager.start(this.mainWindow,{type:Fade, direction:Transition.IN, duration:2, easing:Regular.easeOut});
         //setChildIndex(loader, 0);
         hasloaded = true;
         loadText(index);
    function loadText(index:int):void {
         Object(this).imageBar.txtdescription.text = descriptionArray[index];
    function loadInitialImage(event:Event):void {
         if(!firstLoaded) {
             loader = new Loader();
             loader.load(new URLRequest(bigImageArray[0]));
             this.mainWindow.addChild(loader);
             TransitionManager.start(this.mainWindow,{type:Fade, direction:Transition.IN, duration:2, easing:Regular.easeIn});
             //setChildIndex(loader, 0);
             hasloaded = true;
             loadText(0);
         firstLoaded = true;
    /*  This section defines the buttons that control the image bar */
    Object(this).imageBar.btnBarOpen.addEventListener(MouseEvent.MOUSE_UP, openImageBar);
    function openImageBar(event:MouseEvent):void {
         this.gotoAndPlay(1);

    Well Thats what i know but you might be able to use flash player 10 in your browser i think the file system works on it fine im not sure i mostly work on air glad i could help
    James

  • Creating a very simple XML-driven gallery

    Hi, I'm learning XML in AS3 and I am having real trouble finding a resource that can help me learn how to build a very simple XML-driven picture gallery.
    I am working in an FLA file with AS3, with a dynamic text field with the instance name "textfield". I also have a UILoader Component with the instance name "UILoaderComponent" and an XML file called "rootdir.xml".
    I have an XML file in the following format.
    <images>
         <imagenames>
              <name>image1</name>
              <name>image2</name>
              <name>image3</name>
              <name>image4</name>
              <name>image5</name>
         </imagenames>
         <imagepaths>
              <path>image1.jpg</path>
              <path>image2.jpg</path>
              <path>image3.jpg</path>
              <path>image4.jpg</path>
              <path>image5.jpg</path>
         </imagepaths>
    </images>
    I am using the following as my actionscript.
    var xmlLoader:URLLoader = new URLLoader();
    var xmlData:XML = new XML();
    xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
    xmlLoader.load(new URLRequest("rootdir.xml"));
    function LoadXML(e:Event):void {
    xmlData = new XML(e.target.data);
    parseImg(xmlData);
    function parseImg(imgLoad:XML):void {
    var imgChild:XMLList = imgLoad.images.children();
    for each (var imgTrace:XML in imgChild) {
    trace(imgTrace);
    No matter which way I experiment, I always have poor results with my dynamic text, and every tutorial I've followed does not reproduce anything like the same returned data in "textfield" that it does with the trace command.
    My objective is: I simply want to build a menu inside a textbox called "textfield" that lists images1-5, and when clicked, calls upon the relevant image. For instance: I load the file "rootdir.xml" into the file "index.fla". I call a function to parse the XML into a dynamic text box called "textfield". When image 2 is clicked on the textbox "textfield", it would call upon a function that would load into the UIComponent Loader "image2.jpg".
    Are there any tutorials for this? I'm so confused as to why dynamic text operates so differently from the trace command. I'm not interested in doing a fancy menu bar with thumbnails, scrollbars and animations, I just want to learn the basics.

    I don't really see how you are getting a valid trace out of that code (I get nothing if I try it as is), but as far as the textfield goes, you haven't shown any attempt in your code that might help to point to why you cannot get the text into a textfield.  It might be a problem with how you are trying to write to the textfield and not how your are manipulating the data.
    While you could make use of a textfield for the menu, doing so is not straightforward, as you would need to implement htmlText with special coding in order to have the text clickable.  You might consider using a List component or ComboBox instead.
    What I always do when I am working with xml is to store the data into a data structure, usually an array conatining objects, and then make use of that structure rather than dippng into the xml data itself when I utilize the data.
    Another thing, which rquigley demonstrated, is that your xml will serve its purpose better if the data for each image is collected under the same node.  If you have separate sections for each piece of data like you have, when it comes to editing it will be more prone to error as you have to be sure you are editing the correct entry of each separate group.
    I too am no expert in the world of xml, but I have not yet worked with parameters inside the tags, so I would usually structure it as...
    <images>
       <image>
           <imgName>image 1</imgName>
           <imgPath>image1.jpg</imgPath>
       </image>
       <image>
           <imgName>image 2</imgName>
           <imgPath>image2.jpg</imgPath>
       </image>
    </images>
    Now, back to what you have...  let's say you have a textField named imgText that you want to list the image names in.  The following should work, though I do not go my usual route of storing the data into an object array first...
    function parseImg(imgLoad:XML):void {
       var imgNames:XMLList = imgLoad.imagenames.name;
       var imgPaths:XMLList = imgLoad.imagepaths.path;
       // show name
       for each (var nameTrace:XML in imgNames) {
          trace(nameTrace);
          imgText.appendText(nameTrace +"\n");
       // show path
       for each (var pathTrace:XML in imgPaths) {
          trace(pathTrace);
          imgText.appendText(pathTrace +"\n");
       // show name and path
       for(var i:uint=0; i<imgNames.length(); i++){
          trace(imgNames[i].text()+"  "+imgPaths[i].text());
          imgText.appendText(imgNames[i].text()+"  "+imgPaths[i].text() +"\n");

  • XML driven DataGroup & lastResult or selected item

    I am using a xml driven DataGroup to display images with a itemRenderer and custom layout. When an image is selected i want a new state to display with info from the selected item (image, name, description). Is this possible and how do i do it?
    code example;
              <s:HTTPService id="srv" url="http://...../data/catalog.xml" result="resultHandler(event)" />
              <s:DataGroup includeIn="Main" left="50" right="50" top="200" dataProvider="{items}" id="dg1"
                     horizontalCenter="0" itemRenderer="renderers.kitchensRenderer" click="currentState='details'">
                           <s:layout>
                               <layouts:FilteredTileLayout id="filterLayout" filteredItems="{filteredItems}" />
                           </s:layout>
              </s:DataGroup>
              <mx:Image id="image2" includeIn="details" width="720" height="450" top="75" horizontalCenter="0" src="???" />               how do i get the selected DataGroup item to display the correct image
               //kitchensRenderer
              <mx:Image id="image" width="72" height="45" horizontalCenter="0" source="{data.image}" />

    "implement the property in your model and update the renderer state based on that."
    I am a complete beginner and most of the code I got from TourDeFlex. Please can you explain how to do this or provide a code example, thanks

  • Player help - xml driven mp3

    Hi,
    I have been working on a different effect for a xml driven
    mp3 mini player; it consists of three buttons that plays, pauses
    and unpauses. Only one button is displayed on screen, to its user.
    Now the problem I've got is that when the song ends, the button
    shown is either pause or unpause; due to once the play button is
    initially pressed its visibility is set to false. Now, when the
    songs ends it stops until the user clicks the play button; however
    the play button at present is invisible; so I need a way to display
    the play button when the song ends, so the user can start it again,
    and pause and unpause as normal.
    I have attached the code.
    Quite a challenge, but the effect will be unique. Clbeech
    where are you?
    Kind Regards,
    Boxing Boom

    Hi,
    Nice try, but doesn't resolve the problem. You als forgot to
    add the playSong() function to the play button; So I added it as
    follows;
    //this is the 'play' button
    toggleSound1_btn.onRelease = function() {
    playSong();
    toggleSound2_btn._visible = true;
    this._visible = false;
    And the rest of the code does exactly what it done in the
    first place. But many thanks for trying this for me, I really do
    appreciate you help.
    What we got here, is a RUBICS CUBE! It is mindgame for me!
    Aaaghh! How can a little sound player script be so hard, this is
    not right, is it?
    This is how my layers is set up; Actions, Play, Pause,
    Unpause. This has nothing to do with the problem at hand?
    Kind Regards,
    Boxing Boom

  • How to add fade element to rotating banner (javascript)

    Hi!  I'd like to add a fade element to a rotating banner.  Does anyone have any ideas?  My code is as follows:
    HTML:
    <div style="position:absolute; z-index:2;">
      <a href="linkPage.html"><img src="images/factoryhack2v3.jpg" width="1136" height="285" id="adBanner" border="0"/></a>   
    </div>
    Javascript:
    window.onload = initBannerLink;
    var adImages = new Array("images/img1.jpg","images/img2.jpg","images/img3.jpg");
    var adURL = new Array("URL here","URL here");
    var thisAd = 0;
    function rotate() {
    thisAd++;
    if (thisAd == adImages.length) {
      thisAd = 0;
    document.getElementById("adBanner").src = adImages[thisAd];
    setTimeout("rotate()", 3 * 3000);
    function newLocation() {
    document.location.href = "http://www." + adURL[thisAd];
    return false;
    function initBannerLink() {
    if (document.getElementById("adBanner").parentNode.tagName == "A") {
      document.getElementById("adBanner").parentNode.onclick = newLocation;
    rotate();
    Thanks so much in advance for any assistance

    Lots of different effects for rotating banners are built in to these jQuery plugins:
    Cycle2
    http://www.malsup.com/jquery/cycle2/
    Wow Slider
    http://wowslider.com/
    Nancy O.

  • XML Driven Video Gallery with Playlist

    Hi,
    I have put together a XML Driven Video Player with auto thumbnail detection but there is a problem.The Video plays but, The thumbs will not show. I think my thumbnail function is not reaching the correct node in my XML.Can someone take a look at my Actionscript Please? The Action Script is below. The XML is at the bottom of this post. The top half of the code is the video playing code the bottom is for the thumbs.
    Actionscript 2.0
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    var ns:NetStream = new NetStream(nc);
    ns.setNufferTime(30);
    ns.onStatus = function(info) {
    if (info.code == "NetStream.Buffer.Full") {
    bufferClip._visible = false;
    if (info.code == "NetStream.Buffer.Empty") {
    bufferClip._visible = true;
    if (info.code == "NetStream.Buffer.Stop") {
    ns.seek(0);
    theVideo.attachVideo(ns);
    rewindButton.onRelease = function() {
    ns.seek(0);
    playButton.onRelease = function() {
    ns.pause();
    var videoInterval = setInterval(videoStatus, 100);
    var amountLoaded:Number;
    var duration:Number;
    ns["onMetaData"] = function (obj) {
    duration = obj.duration;
    function videoStatus() {
    amountLoaded = ns.bytesLoaded/ns.bytesTotal;
    loader.loadbar._width = amountLoaded*187.4;
    loader.scrub._x = ns.time/duration*187.4;
    var scrubInterval;
    loader.scrub.onPress = function() {
    clearInterval(videoInterval);
    scrubInterval = setInterval(scrubit, 10);
    this.startDrag(false,0,this._y,187.4,this._y);
    loader.scrub.onRelease = loader.scrub.onReleaseOutside=function () {
    clearInterval(scrubInterval);
    videoInterval = setInterval(videoStatus, 100);
    this.stopDrag();
    function scrubit() {
    ns.seek(Math.floor((loader.scrub._x/187)*duration));
    var theMenu:ContextMenu = new ContextMenu();
    theMenu.hideBuiltInItems();
    _root.menu = theMenu;
    var i1:ContextMenuItem = new ContextMenuItem(":::::Video Controls:::::", trace);
    theMenu.customItems[0] = i1;
    var i2:ContextMenuItem = new ContextMenuItem("Play / Pause Video", pauseIt, true);
    theMenu.customItems[1] = i2;
    var i3:ContextMenuItem = new ContextMenuItem("Replay Video", replayIt);
    theMenu.customItems[2] = i3;
    var i4:ContextMenuItem = new ContextMenuItem("All Rights Reserved 2009", trace, true);
    theMenu.customItems[3] = i4;
    var i5:ContextMenuItem = new ContextMenuItem("SamAndOnline.com Video Player", trace);
    theMenu.customItems[4] = i5;
    function pauseIt() {
    ns.pause();
    function replayIt() {
    ns.seek(0);
    //sound controls
    _root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
    vSound.attachAudio(ns);
    var so:Sound = new Sound(vSound);
    so.setVolume(100);
    volControl.volcon.slider1.onPress = function() {
    this.startDrag(true,volControl.volcon.groove1._x,volControl.volcon.groove1._y,volControl.v olcon.groove1._x,volControl.volcon.groove1._y+100);
    slideit = setInterval(volControl.volcon.slider_1Move, 100, this);
    volControl.volcon.slider1.onRelease = function() {
    this.stopDrag();
    clearInterval(slideit);
    mute.gotoAndStop("on");
    volControl.volcon.slider1.onReleaseOutside = function() {
    this.stopDrag();
    clearInterval(slideit);
    mute.gotoAndStop("on");
    mute.onRollOver = function() {
    if (so.getVolume() == 100) {
    this.gotoAndStop("onOver");
    } else {
    this.gotoAndStop("muteOver");
    mute.onRollOut = function() {
    if (so.getVolume() == 100) {
    this.gotoAndStop("on");
    } else {
    this.gotoAndStop("mute");
    mute.onRelease = function() {
    if (so.getVolume() == 100) {
    so.setVolume(0);
    this.gotoAndStop("muteOver");
    } else {
    so.setVolume(100);
    this.gotoAndStop("onOver");
    //listBx
    var vlist:XML = new XML();
    vlist.ignoreWhite = true;
    vlist.onLoad = function() {
    var videos:Array = this.firstChild.childNodes;
    for (i=0; i<videos.length; i++) {
    videoList.addItem({label:videos[i].attributes.desc,data:videos[i].attributes.url ,image:videos[i].attributes.thumb});
    //play 1st video
    ns.play(videoList.getItemAt(0).data);
    videoList.selectedIndex = 0;
    //would like to reference something in the XML File with the thumb attribute
    thumbnails_fn(i);
    var vidList:Object = new Object();
    vidList.change = function() {
    ns.play(videoList.getItemAt(videoList.selectedIndex).data);
    videoList.addEventListener("change",vidList);
    vlist.load("videos.xml");
    soundb.onRelease = function() {
    if (volControl.switch2=open2) {
    volControl.gotoAndPlay("open");
    } else {
    volControl.play();
    function thumbNailScroller() {
    // thumbnail code!
    this.createEmptyMovieClip("tscroller", 1000);
    scroll_speed = 10;
    tscroller.onEnterFrame = function() {
    if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
    if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
    thumbnail_mc._x -= scroll_speed;
    } else if ((_root._xmouse<=40) && (thumbnail_mc.hitTest(hit_left))) {
    thumbnail_mc._x += scroll_speed;
    } else {
    delete tscroller.onEnterFrame;
    function thumbnails_fn(k) {
    thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
    tlistener = new Object();
    tlistener.onLoadInit = function(target_mc) {
    target_mc._x = hit_left._x+(eval("thumbnail_mc.t"+k)._width+5)*k;
    target_mc.pictureValue = k;
    target_mc.onRelease = function() {
    p = this.pictureValue-1;
    nextImage();
    target_mc.onRollOver = function() {
    this._alpha = 50;
    thumbNailScroller();
    target_mc.onRollOut = function() {
    this._alpha = 100;
    image_mcl = new MovieClipLoader();
    image_mcl.addListener(tlistener);
    image_mcl.loadClip(image[k], "thumbnail_mc.t"+k);
    trace(videoList.getItemAt(0).image+ "k= "+k+" "+videos.length+" pv "+target_mc.pictureValue+" thumbnails");
    XML Example
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <videos>
    <video url="vid1.flv" desc="Video 1" thumb="1.jpg"/>
    <video url="vid2.flv" desc="Video 2" thumb="2.jpg"/>
    </videos>

    I'm trying to load the thumbnails in with this code
    image_mcl.loadClip(image[k], "thumbnail_mc.t"+k);
    i tried
    videoList.getItemAt(k).image
    which works in the trace method but gives no response in the actual code it self
    So the line of code that should work is
    image_mcl.loadClip(videoList.getItemAt(k).image, "thumbnail_mc.t"+k);
    and not
    image_mcl.loadClip(image[k], "thumbnail_mc.t"+k);
    but I gets no response

  • XML Driven

    Hello World,
    I'm interested in a photo stack gallery.
    Here is an example: http://www.flashdevelopment.de/CONTENTS/3DPHOTOSTACKGALLERY02/3dphotostackgallery02.php
    I want to use a photo stack gallery on my multiple affiliate websites to display my products.
    What I want to be able to do is add and delete photos very fast, without having to fiddle around with xml or any other codes.
    Can I do this with this product or is there some other simple, reliable and cheap product that I can?
    Is a bulk preloader a code-work-around solution?
    In other words does a bulk preloader make a photo stack gallery an image drag-and-drop photo stack gallery?
    Said differently once more, is there a way to add multiple images fast to an xml driven photo stack gallery without fiddling around with xml code?
    Thank you for your help,
    Jerry

    the xml will need to be edited to make changes to any xml-driven application whether that's a photo gallery or any other xml-driven application.
    typically, you do that by opening up the xml file in a text editor and "fiddling" with code and then uploading the needed file(s) including the edited xml and the photo(s).   but an editor can be created (i make them using flash) that eliminates the need to fiddle with code ftp file uploads.
    in the case of a photo gallery, you would:
    1.  open the editor
    2.  enter your password (because you don't want anyone else editing your gallery)
    3.  you would be presented with an easy-to-use display - not code.
    typically, for a photo gallery, that display would be:
    1.  select a category (from a combobox), eg, shirts, pants, ties
    2.  select one of 3 options, add, edit or delete
    3.  if add was selected, you would be presented with
        a.  add after photo number.
        b.  add before photo number.
    4. browse for file dialogue box would open so you could click on the file (on your computer), that you want to add.
    5. a confirmation would appear (if all went well) that your photo was uploaded and added to your gallery.
    6.  return to 1.
    usually, there will be more involved (like a description/text) that should accompany the photo.  but that gives you the general outline of how a user-friendly editor would work.
    if you want me to build one for you, send an email via my website:  www.kglad.com

  • How to create rotating banner ad?

    Hi,
    I am a complete and utter newbie when it comes to flash. I've bought Flash Professional CS5, and I am looking for a tutorial/help to create a rotating banner ad similar to the one on www.play.com.
    Example: I've got four different pictures I want to rotate within let's say 3-4 seconds per picture. Each of the picture needs its own link, so people can click to get to the correct place. I want the pictures to "fade out to the left" when changing) How do I do this? Is there a simple tutorial? I've heard "flash is so easy", but I am having a hard time to grasp around it.
    Anyone got any tips?

    Thank you, I will check that out. When you say my Action Script Version, I've noticed that I can go up to 3. Are there any recommendations for this? What do the action scripts do? What would you suggest for a slideshow?

Maybe you are looking for

  • Getting Error while creating EM console on standby db

    Hi, Please guide me. I created physical standby database and open the standby db in read only mode. Now i drop the em repository and create it again. while providing password for DBSNP user emca return invalide user/password. whereas i am sure about

  • Late 2011 17" Macbook Pro upgrade advice needed

    Hey everybody, I would like to u[grade my Late 2011 17" Macbook Pro. 8GB DDR3 RAM 750GB HDD OSX 10.7.4 So after reading on Crucial.com that I could house 16gb ram, despite what apple said, I investigated this and according to people this is tr So my

  • Payment terms in bapi

    Hi im trying to change customer data using the BAPI BAPI_CUSTOMER_CHANGEFROMDATA1. I manage to change all the fields except the payment terms field. Whay is it hapenning?

  • Does Apple make a cable modem?

    I hate having to lease my modem from stupid time warner, does apple have a cable modem?

  • How do I get downloaded games to open?

    Downloaded the new wartune mini, and it wont open.