Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-27-2003, 09:48 AM   #1
pragathikanth
Registered User
 
Join Date: Mar 2002
Location: India
Posts: 12
Send a message via Yahoo to pragathikanth
Default FListBox - rollOver, rollOut and Double Click

Hi All,

I have a couple of questions here.

1) Is it possible to call a function on rollover and rollout of items in a list box?

2) Is it possible to capture a double click on selection a item in the list box?

Can anyone help me with these two problems? I need to achive this functionality in the listbox.

Thanks for your time
pragathikanth is offline   Reply With Quote
Old 03-30-2003, 06:37 AM   #2
tyard
Registered User
 
Join Date: Jan 2003
Location: NYC
Posts: 58
Default

Yes. Find the FSelectableItem in your library:

Flash UI Components > Core Assets - Developer Only > FUIComponent Class Tree > FUI Component SubClasses > FSelectableList

In the init() function, place the code for your handlers:

Code:
this.onRollOver = function() {
	trace(this._parent._parent.labels[this.itemNum]);
};

this.onRollOut = function() {};
This function will obviously apply to all items, so you'll have to have to use the itemNum variable to create different actions (if needed).

For a double click, find the setSize method in the same symbol and change the highlight_mc.onPress (around line 65) to be:

Code:
this.highlight_mc.onPress = function()
{
	if (this.controller.enable && (getTimer() - this.firstClick < 1000)) {
		this.controller.controller.clickHandler(this.controller.itemNum);
	}
	this.firstClick = getTimer();
}
tyard is offline   Reply With Quote
Old 04-03-2003, 04:16 AM   #3
djungle
Member
 
Join Date: Jul 2002
Location: Planet Rock
Posts: 74
Default

Hi,
Sorry to barge in, but its kind of related.

Is it possible to get the hand to show (when over the listBox) instead of the arrow?

Thanks
djungle is offline   Reply With Quote
Old 04-03-2003, 12:26 PM   #4
tyard
Registered User
 
Join Date: Jan 2003
Location: NYC
Posts: 58
Default

Somewhere in the code you'll find:

xx.useHandCursor = 0;

(xx will be an instance name)

Do a search for "useHand" and you'll find it. Comment this line out and you should get the hand back.
tyard is offline   Reply With Quote
Old 04-03-2003, 01:58 PM   #5
djungle
Member
 
Join Date: Jul 2002
Location: Planet Rock
Posts: 74
Default

Thanks, Worked like a charm.
djungle is offline   Reply With Quote
Old 04-04-2003, 09:29 AM   #6
pragathikanth
Registered User
 
Join Date: Mar 2002
Location: India
Posts: 12
Send a message via Yahoo to pragathikanth
Default

Thanks a ton tyard, It works .

What I want to know is how to apply this only to a single component. Or make a custom component so that it does not effect the default functionality of the other components. As I am using list box component in more than one instance. It will not be fesable to edit the actual component itself. Any work around for this.
A custom component with change handlers for on RollOver, onRollOut and, double Click. Where we can set the change handlers from outside insted of defining them in the FSelectableList.

I am not much of a programmer and I do not know how to create custom components I am strugging to get these things to work.

Can you pleas help me with this, how do I go about making a custom component with (rollOver, rollOut and double click) functionality. I would be really greatful for all your help.

Thanks a lot for your time.

Last edited by pragathikanth; 04-04-2003 at 10:07 AM.
pragathikanth is offline   Reply With Quote
Old 04-06-2003, 12:18 AM   #7
tyard
Registered User
 
Join Date: Jan 2003
Location: NYC
Posts: 58
Default

Well, I believe you could just extend the component with another movieclip. Just conjecturing, but try to create a new symbol in your library (duplicate the ListBox component symbol so you have all of its contents) and use code like this inside:

Code:
#initclip 3

myListBox = function() {
	this.init();
};

var p = myListBox.prototype = new FListBoxClass(); // not sure of the Class name, so double check

p.onRollOver = function() {
	// new code
};

p.onRollOut = function() {
	// new code
};

p.onPress = function() {
	// new code
};

Object.registerClass("myListBox", myListBox);

delete p;

#endinitclip
Be sure to export the symbol as "myListBox". This should create a new symbol that inherits everything from FListBox so you can safely overwrite certain methods.

Again, I'm writing off the top of my head, so this isn't guaranteed to work as written, if at all. It's just a possibility.
tyard is offline   Reply With Quote
Old 04-08-2003, 12:03 PM   #8
pragathikanth
Registered User
 
Join Date: Mar 2002
Location: India
Posts: 12
Send a message via Yahoo to pragathikanth
Default

Thanks tyard,

I still need to work on that, but what you have suggested makes sense Will get back to you if I face any more problems Thanks again for all the help.

Cheers,
PK
pragathikanth is offline   Reply With Quote
Old 09-08-2003, 11:19 AM   #9
flashdudette
He is Risen!
 
flashdudette's Avatar
 
Join Date: Mar 2002
Location: usa
Posts: 432
Default

Here is an example:
All I wanted was a rollover movieclip that shows a fading in.
Step 1:
Duplicate FListBoxItem in library and call it FCUstomItem (or anything else).

Step2:
Create a movieclip (instance name rollOver_mc) as follow:
- first frame : empty,
- next 4 frames have a fading in.
action for frames:
- frame 1: stop();
- frame 5: stop();
Add this mc into the FCustomItem into a new layer. (make sure the registration point is at the right place so the width will match the listbox).

Step 3:
The class is extended by adding the following code in the FCUstomItem action layer :
ActionScript Code:
#initclip 3 /*         FCustomItemClass         EXTENDS FSelectableItemClass         This is a customized LIst Item. */ function FCustomItemClass() {     this.init(); } FCustomItemClass.prototype = new FSelectableItemClass(); Object.registerClass("FCustomItemSymbol", FCustomItemClass); // code for rollOver FCustomItemClass.prototype.onRollOver = function() {     this.rollOver_mc.gotoAndPlay(2);     this.rollOver_mc._width = this.fLabel_mc._width+this.icon_mc._width+15; };

step 4
Do not forget Linkage Id for FCUstomItem symbol. Go to the library. Right clik on FCUstomItem, clik on linkage, type in identifier:FCustomItemSymbol and check Export in First Frame.


Hope this helps.
__________________
------------------------
Call on the name of the Lord and you will be saved.
flashdudette is offline   Reply With Quote
Old 09-08-2003, 11:51 AM   #10
flashdudette
He is Risen!
 
flashdudette's Avatar
 
Join Date: Mar 2002
Location: usa
Posts: 432
Default

Sorry about that - You do need to add your onPress function for it to work.
__________________
------------------------
Call on the name of the Lord and you will be saved.
flashdudette is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:49 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.