Go Back   OXYLUS Flash Board > Support > Horizontal Scroller

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-04-2008, 08:22 AM
Super Moderator
 
Join Date: May 2008
Posts: 519
Send a message via Skype™ to Adrian
Default Firing actions when a thumbnail is clicked

1. Making Horizontal Scroller open a url:

- Open the xml file and write your urls in the data attribute
<item ... data="www.google.com" />
- Write the code to open the url:

function clickHandler(dat, lbl) {
// handler function receives "data" (dat variable) as string and "label" (lbl variable) as string
getURL(dat);
}



2. Making Horizontal Scroller play a frame number:

- Open the xml file and write your frame number in the data attribute
<item ... data="7" />
- Write the code to play to that frame:

function clickHandler(dat, lbl) {
// handler function receives "data" as string and "label" as string
var frame:Number = Number(dat);
some_mc.gotoAndPlay(frame);
}



2. Making Horizontal Scroller play a frame given by label:

- Open the xml file and write your frame label in the data attribute
<item ... data="intro" />
- Write the code to play to that frame:

function clickHandler(dat, lbl) {
// handler function receives "data" as string and "label" as string
var label:String = dat;
some_mc.gotoAndPlay(label);
}



Additionaly:

In the Thumbnail.as file you can customize the way thumbnails will look or behave. Just read the comments and alter the variables so you'll get the result you desire.

In the HScroller.as file you can find additional variables wich can be altered with effects on the Scroller's list of thumbs.
Reply With Quote
  #2 (permalink)  
Old 05-11-2008, 01:26 AM
Junior Member
 
Join Date: May 2008
Posts: 2
Default Re:firing actions

I followed Adrian's note for firing actions on thumbnail click.
My version does not fire.

I believe that the component is getting the 'data' - I debugged first within Flash CS3.

My application development environment is VS2005 - VB

I presume that the j script clickHandler(dat, lbl) should be at the top of the .aspx page inside the usual script tags?

Any suggestions as to what might be wrong?

Regards,

Steve
Reply With Quote
  #3 (permalink)  
Old 05-11-2008, 04:16 PM
Super Moderator
 
Join Date: May 2008
Posts: 519
Send a message via Skype™ to Adrian
Default

Hello,
That function must be written inside the main .fla file, not outisde Flash. If you open HScroller.fla file and you look into the first frame (layer named "AS") you will see that function there. All you have to do is edit it to do the desired action.
Reply With Quote
  #4 (permalink)  
Old 05-13-2008, 01:07 AM
Junior Member
 
Join Date: May 2008
Posts: 2
Default

Quote:
Originally Posted by Adrian View Post
Hello,
That function must be written inside the main .fla file, not outisde Flash. If you open HScroller.fla file and you look into the first frame (layer named "AS") you will see that function there. All you have to do is edit it to do the desired action.
Hi,

Yes I found that now & all works very well.

A usage guide would have been usefull - like FlashLoaded or JumpEye provide.
It would just take out the guesswork.

Component works VERY well & is probably the best of those tested.
see it in action at www.OakwoodStud.co.uk/HorsesForSale.aspx

Thanks again.
Steve
Reply With Quote
  #5 (permalink)  
Old 05-28-2008, 09:12 PM
Junior Member
 
Join Date: May 2008
Posts: 2
Default

I have changed the action in my AS layer and it still won't do anything when the thumbnail is clicked is there anything I'm missing here:

Stage.scaleMode = "noScale";
Stage.align = "TL";
Stage.showMenu = false;
// include the MC Tween file
#include "MCTween.as"
//
var xmlOb:XML = new XML();
xmlOb.ignoreWhite = true;
xmlOb.onLoad = function(s:Boolean) {
if (!s) {
trace("XML load error: Unable to load/parse XML.");
return;
}
if (this.status == 0) {
// xml loade successfully
init(this.firstChild);
//=====
return;
}
// handle errors
var errorMessage:String = "XML was loaded successfully, but was unable to be parsed.\n";
switch (this.status) {
case -2 :
errorMessage += "A CDATA section was not properly terminated.";
break;
case -3 :
errorMessage += "The XML declaration was not properly terminated.";
break;
case -4 :
errorMessage += "The DOCTYPE declaration was not properly terminated.";
break;
case -5 :
errorMessage += "A comment was not properly terminated.";
break;
case -6 :
errorMessage += "An XML element was malformed.";
break;
case -7 :
errorMessage += "Out of memory.";
break;
case -8 :
errorMessage += "An attribute value was not properly terminated.";
break;
case -9 :
errorMessage += "A start-tag was not matched with an end-tag.";
break;
case -10 :
errorMessage += "An end-tag was encountered without a matching start-tag.";
break;
default :
errorMessage += "An unknown error has occurred.";
break;
}
trace("XML parse error:"+errorMessage);
};
// set click handler function
function clickHandler(dat, lbl) {
// handler function receives "data" as string and "label" as string
var label:String = dat;
some_mc.gotoAndPlay(label);
}

function init(n:XMLNode) {
// set data for the scroller instance named "scr"
// method name is setData
// parameters must be the root node of the xml and a handler function
scr.setData(n, clickHandler);
}
// load XML file
xmlOb.load(xml == undefined ? "data.xml" : xml);
// Press any key to clear thumb selection
this.onKeyDown = function() {
Thumbnail.clearSelection();
};
Key.addListener(this);
Reply With Quote
  #6 (permalink)  
Old 06-20-2008, 10:19 AM
Super Moderator
 
Join Date: May 2008
Posts: 519
Send a message via Skype™ to Adrian
Default

It should be like:

function clickHandler(dat, lbl) {
// handler function receives "data" as string and "label" as string
var label:String = dat;
some_mc.gotoAndPlay(dat);
}
Reply With Quote
  #7 (permalink)  
Old 07-03-2008, 08:34 PM
Junior Member
 
Join Date: Jul 2008
Posts: 4
Default

thank you for your help,

I was able to install and copy the files to my main site, I understood the operation for simple actions (geturl, etc. ...) with horizontal scroller


but how to call a clip of my site with these parameters.

in resum, how to convert:

root.page = "contact";

in:

function clickHandler(dat, lbl) {
// handler function receives "data" as string and "label" as string
var label:String = dat;
some_mc.gotoAndPlay(dat);
}



thank you for your help,

PS: I will take the time to learn the basic functions of as2 in a few months but for now I can not.

sorry for my english I'm french user...
Reply With Quote
  #8 (permalink)  
Old 07-05-2008, 01:37 PM
Junior Member
 
Join Date: Jul 2008
Posts: 4
Default

Good morning,

no member has an idea to help me?

I tested several times but without success.

I traveled the forum, I looked in vertical menu section, but I did not find an answer that helps me.
Reply With Quote
  #9 (permalink)  
Old 07-05-2008, 01:49 PM
Super Moderator
 
Join Date: May 2008
Posts: 519
Send a message via Skype™ to Adrian
Default

- Open the xml file and write your frame label in the data attribute

Code:
<item ... data="contact" />
- Write the code to play to that frame:

Code:
function clickHandler(dat, lbl) {
    root.page = dat;
}
Reply With Quote
  #10 (permalink)  
Old 07-05-2008, 02:18 PM
Junior Member
 
Join Date: Jul 2008
Posts: 4
Default

Adrian thank you,
I have tested it :
root.page = "dat";
root.page = (dat);

but I didn't think at this...

You must find it so ridiculous but it will help me a lot.

when I will finish the work of my apartment and after the birth of my son, I will learn bases as2 and AS3, in order to stop wasting time (and your time...)

a good weekend for you, I testing as soon tonight

easysofts
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.