Add URL to XML File - Flash CS4

Discussions about the Thumbnail Scroller component.

Add URL to XML File - Flash CS4

Postby maryann1914 on Mon Jun 14, 2010 1:46 pm

Hi David,

From the examples provided with the Thumbnail Scroller, I'm using "scroller_ex6.fla" as the basis for my scroller. The only change I made was to edit the XML file with my images. I'm really new to all of this and your examples really help.

Everything looks great, but how do I add URL's to the XML file? I've tried to follow the examples in the users guide, and in a previous post I found here, but neither one is working.

Thank you,
Mary Ann
maryann1914
 
Posts: 3
Joined: Mon Jun 14, 2010 1:26 pm

Re: Add URL to XML File - Flash CS4

Postby David on Mon Jun 14, 2010 1:55 pm

Hi Mary Ann,

Please see this tutorial.
Let me know if you need further help with this.
David
Site Admin
 
Posts: 350
Joined: Tue Nov 04, 2008 4:38 pm

Re: Add URL to XML File - Flash CS4

Postby maryann1914 on Mon Jun 14, 2010 2:40 pm

David, thank you for answering so quickly. It's still not working. I'm really new to Flash and Actionscript, so please bear with me. And I'm using Flash CS4, Actionscript 3, in case you needed to know that.

I pasted the actionscript code from the link you sent me to (the code that's under the XML instructions) into the actions panel in the Flash file. There's already quite a bit of code there, since I'm using one of your examples, so I just pasted it at the end.

Then I added the link to my XML file. When I test the movie, the scrollbar blinks constantly, and none of the images show up - everything is blank.

In the Output panel, I get the following errors:
1021: Duplicate function definition.
5000: The class 'com.flashotaku.effects.collection.ScaleEffect' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
5000: The class 'com.flashotaku.scrollbar.ScrollBar' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
5000: The class 'com.flashotaku.scroller.ThumbnailScroller' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.

What did I do wrong?
Thank you.
maryann1914
 
Posts: 3
Joined: Mon Jun 14, 2010 1:26 pm

Re: Add URL to XML File - Flash CS4

Postby David on Mon Jun 14, 2010 3:06 pm

Ok. It seems that you already have the "itemClickHandler" function in the scroller_ex6 file. In that case, you don't need to copy all the code from that tutorial.

Delete all the code from the file and paste this one:

Code: Select all
import com.flashotaku.events.ScrollerEvent;
import com.flashotaku.events.ScrollBarEvent;
import flash.events.MouseEvent;


// listen for item clicks
myScroller.addEventListener(ScrollerEvent.ITEM_CLICK, itemClickHandler);

// listen when the component is in the scrolling process
myScroller.addEventListener(ScrollerEvent.SCROLL_PROGRESS, scrollProgressHandler);

function itemClickHandler(event:ScrollerEvent):void
{
   // event.index is the index of the clicked item
   // when an item is clicked, scroll to that item
   myScroller.select(event.index);

        // navigate to link
        navigateToURL(new URLRequest(event.data.link), "_self");
}


function scrollProgressHandler(event:ScrollerEvent):void
{
   //if the scrollbar thumb is not being dragged, adjust the thumb's positoin based on the scroller's position
   if (!myScrollBar.isDragging)
   {
      myScrollBar.currentPosition = myScroller.currentPosition;
   }
}


// listen when the scrollbar thumb changes its position
myScrollBar.addEventListener(ScrollBarEvent.CHANGE, scrollBarChangeHandler);

function scrollBarChangeHandler(event:ScrollBarEvent):void
{
   //adjust the scroller's positoin based on the thumb's position
   myScroller.currentPosition = myScrollBar.currentPosition;
}
David
Site Admin
 
Posts: 350
Joined: Tue Nov 04, 2008 4:38 pm

Re: Add URL to XML File - Flash CS4

Postby maryann1914 on Mon Jun 14, 2010 3:30 pm

David, thank you! It worked. I also just want to tell you that the thumbnail scroller is the best. It works beautifully, and I really appreciate how quickly you answered my questions.
maryann1914
 
Posts: 3
Joined: Mon Jun 14, 2010 1:26 pm

Re: Add URL to XML File - Flash CS4

Postby David on Mon Jun 14, 2010 3:40 pm

You're most welcome :)
David
Site Admin
 
Posts: 350
Joined: Tue Nov 04, 2008 4:38 pm


Return to Thumbnail Scroller

Who is online

Users browsing this forum: No registered users and 1 guest

cron