Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-25-2005, 07:24 AM   #1
Billystyx
Billystyx
 
Join Date: May 2005
Location: UK
Posts: 443
Default Extending Accordion component

Wondering if anyone can help me. I would like the accordion component to change according to a rollover event on the headers, raher than by clicking the headers. The trouble is, there doesn't seem to be this functionality to the accordion component (that I can see).

So I figured, maybe I can extend the accordion class for this purpose. BUT, I don't know how to do this. Are any any tutes that relate specifically to this, rather than to making a component textfield or something simple like that.

The code relating to the headers seems to be in the accordionheader.as, rather than in the accordion as, so I don't really know where to begin. Do I create a whole new class for the accordion header and one for the accordion and then export as a new component? Or what?

I am still coming to terms with component building, but have only built on movieclips, not on the UI framework.

Anyway, if someone can point me in the right direction I would be happy.

Cheers,

Billystyx
Billystyx is offline   Reply With Quote
Old 07-25-2005, 02:01 PM   #2
sleekdigital
I like pizza!
 
Join Date: Feb 2003
Location: PA
Posts: 1,310
Send a message via AIM to sleekdigital Send a message via MSN to sleekdigital Send a message via Yahoo to sleekdigital
Default

I think you will need to extend the Accordian class rather than the header class. Just looking into this a little I see on line 638 of the accordian class ...

header_mc.clickHandler = function() { _parent.headerPress(this) };

That seems to be what causes a click in the header to open the appropriate panel, so I would thingk you would want to change that to header_mc.onRollOver to something. I imagine It would be possible to extend the header class, but then you would still have to extend or modify the accordian class to change line 77 ...

private var headerClass:Function = AccordionHeader;

You would need to change that to your header class extension.

As far a the process of actually extending the MM components, I'm not sure. I've always used composition to add functionality to components, I've never tried changing functions through inheritance. Let us know what you find
sleekdigital is offline   Reply With Quote
Old 07-25-2005, 02:11 PM   #3
Billystyx
Billystyx
 
Join Date: May 2005
Location: UK
Posts: 443
Default

cheers. That's the same line I initially found - but I think I tried something like

ActionScript Code:
header_mc.onRollOver =header_mc.clickHandler

which didn't seem right at the time - but I was at a loss for how else to do it..

I will have another look and see if just changing/adding this function might do it. I know if you extend the accordion class and add a new headerPress function it will change what the headerPress function does once compiled as a new component, its just the rollover thing that's an issue. I think because onRollOver is part of the movieClip class, (and I don't know enough about this stuff to know for sure), but I seem to remember adding an onRollOver event to an extension of a component generated an error.

If all else fails, I will make my own component - can't be that difficult

Thanks for your response,

Billystyx
Billystyx is offline   Reply With Quote
Old 07-25-2005, 02:19 PM   #4
sleekdigital
I like pizza!
 
Join Date: Feb 2003
Location: PA
Posts: 1,310
Send a message via AIM to sleekdigital Send a message via MSN to sleekdigital Send a message via Yahoo to sleekdigital
Default

I don't think there should be any problem adding onRollOver to a Component... if you notice, MM does it in the AccordionHeader and AccordionHeader is an extension of the Button component.
sleekdigital is offline   Reply With Quote
Old 07-25-2005, 02:45 PM   #5
Billystyx
Billystyx
 
Join Date: May 2005
Location: UK
Posts: 443
Default

good point - must have been my syntax!

I'll give it a try - cheers for your advice.

billystyx
Billystyx is offline   Reply With Quote
Old 07-25-2005, 04:57 PM   #6
sleekdigital
I like pizza!
 
Join Date: Feb 2003
Location: PA
Posts: 1,310
Send a message via AIM to sleekdigital Send a message via MSN to sleekdigital Send a message via Yahoo to sleekdigital
Default

Actually, that brings up another thing to consider... since AccordionHeader already defines onRollOver, we can't just redefine it without breaking it. So you might need to extend AccordionHeader and dispatch an event in the onRollOver handler. Then in the class that extends Accordian, handle that event and call _parent.headerPress(this)
sleekdigital is offline   Reply With Quote
Old 07-26-2005, 10:40 AM   #7
Billystyx
Billystyx
 
Join Date: May 2005
Location: UK
Posts: 443
Default

I will try this - as you predicted, the other way didn't work - I ended up with the whole component having a rollover and no clickable or rollover-able buttons. This seems to make more sense - cheers,

billystyx
Billystyx is offline   Reply With Quote
Old 07-27-2005, 08:00 AM   #8
Billystyx
Billystyx
 
Join Date: May 2005
Location: UK
Posts: 443
Default

just to give you the latest - I gave up on trying to extend the accordion component - found a class created by richardleggett here that did the job well with a few minor changes - I uploaded the fla and as script of my altered version there as well. Have made a few other minor changes - but the script is easily customizable and a better size, I think.

cheers for your help,

billystyx
Billystyx is offline   Reply With Quote
Old 07-27-2005, 01:09 PM   #9
sleekdigital
I like pizza!
 
Join Date: Feb 2003
Location: PA
Posts: 1,310
Send a message via AIM to sleekdigital Send a message via MSN to sleekdigital Send a message via Yahoo to sleekdigital
Default

Cool, thanks for the update!
sleekdigital is offline   Reply With Quote
Old 06-21-2006, 02:56 PM   #10
.Bruno
Registered User
 
Join Date: Jun 2006
Location: Holland
Posts: 53
Default

Thanks for the hint!!!
.Bruno 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 09:27 AM.

///
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.