A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 26

Thread: [CS3] Carousel Class

  1. #1
    11 Years Old Boya
    Join Date
    Apr 2004
    Posts
    61

    [CS3] Carousel Class

    Hello people of Flashkit!


    I don't know if this is really the place to post this topic, but I have created something thats not a game, but can be useful to games and websites. It is the actionscript 3 version of the 3d carousel based on Lee Brimelow's three part tutorials. I decided to create this for people who want a 3d carousel in their Flash CS3 projects.

    Please note that this is my first completed AS3 class and was created within the first few weeks of playing around with Flash CS3, so the code might not be efficient and optimized.

    Screenshot

    Features:

    -fast and easy to setup
    -uses xml to setup carousel items
    -can use MovieClips from the library as items
    -customizable functions

    Instructions are provided in the readme.txt.

    Thanks to Lee for his tutorials, and people here at FlashKit who helped me with AS3.

    Any bug, suggestions, and help with optimizing the code is greatly appreciated.
    Attached Files Attached Files
    Checkout my site:
    Click HERE
    Checkout my games:
    Oops! No game for now!

  2. #2
    Senior Member Alluvian's Avatar
    Join Date
    Jun 2006
    Posts
    967
    Wow, looks pretty! Would be a great way for me to select ships in my current game, but I would have to reskin it since the slick iphone look would clash heavily with my game.

    definately going to bookmark this for when I am doing cleanup and final interface.

  3. #3
    11 Years Old Boya
    Join Date
    Apr 2004
    Posts
    61
    Okay, I finally finished a new version of this class [v1.1]

    This version contain extra functions to manipulate the icons. The demo is also updated demonstrating how to remove individual items from the carousel.

    New Functions:

    setIcon(index:Number, itemIcon:String):void
    - change the image/swf of an existing item, or convert external image/swf to
    MovieClip item or the opposite.
    - index: index of item to change
    - itemIcon: name of external image/swf or movieclip
    setFunction(index:Number, itemFunction:String):void
    - replace existing mouse down function of an item
    - index: index of item to change
    - itemFunction: name of new function
    setTooltip(index:Number, itemTip:String):void
    - replace the tooltip of an item
    - index: index of item to change
    - itemTip: new tooltip

    I noticed some errors and I think most of them are fixed.

    Hope you enjoy using this class.

    PS: Umm, how can I edit my first post?
    Attached Files Attached Files
    Last edited by Gamerflash; 08-30-2007 at 01:22 AM. Reason: Changed the ps.
    Checkout my site:
    Click HERE
    Checkout my games:
    Oops! No game for now!

  4. #4
    SaphuA SaphuA's Avatar
    Join Date
    Oct 2002
    Location
    The Netherlands
    Posts
    2,182
    Just a little thank you, no comments so far.

    You can edit your post by pressing the edit button? =)
    Ps. Oh yeah, I forgot, it only works for about 10 minutes after you've posted.

  5. #5
    11 Years Old Boya
    Join Date
    Apr 2004
    Posts
    61
    Ahoy! Another version of this class with two more useful functions:

    addItem(itemName:String, tooltip:String, functions:String):void
    - add a new item on the last index
    - itemName: the filename or the name of the movieclip (using '.mc' at the end)
    - tooltip: tooltip for this item
    - functions: mouse down function
    swapItem(index1:int, index2:int):void
    - switch the item with index1 with the item with index2
    - index1: item to be switched with
    - index2: item to be switched with
    getSource(index:int):String
    - return the source of image/movieclip
    - index: index of the item

    Once again, the demo is updated to demonstrate two of the three functions.

    Hope you enjoy it!

    Download version 1.3
    Checkout my site:
    Click HERE
    Checkout my games:
    Oops! No game for now!

  6. #6
    11 Years Old Boya
    Join Date
    Apr 2004
    Posts
    61
    Oops! The link lead to v1.1
    Sorry for that!
    New link: http://www.filefactory.com/file/195582
    Checkout my site:
    Click HERE
    Checkout my games:
    Oops! No game for now!

  7. #7
    Junior Member
    Join Date
    Sep 2007
    Posts
    3

    Download request location change

    I want to thank you for the download.
    It has been very helpful.

    I was trying to convert the code from Lee to AS3 but was bogged
    down when it came to switching the depths.

    As you know handling depths in AS3 is different than in AS2.

    In many ways it's easier, but in others (like in this case) it's
    more difficult at least for me.
    I'm sure it's because I probably haven't fully grasped the concept
    of the best way to use it.

    I would like to request if you could place this last download
    in the same place you did the original download.

    I'm at work and Websense is blocking that last link you gave us.

    Thanks,

    Rockdragon

  8. #8
    11 Years Old Boya
    Join Date
    Apr 2004
    Posts
    61
    Ok here's a better link:
    http://shipwar.freepgs.com/carousel/
    Hope nothing block the link above. I can't edit the first post, so the above link will always be updated. I'll also post update in this topic so subscribe if you want to.
    Checkout my site:
    Click HERE
    Checkout my games:
    Oops! No game for now!

  9. #9
    Junior Member
    Join Date
    Sep 2007
    Posts
    4
    I downloaded all 3 versions, and tried each in MX, 8 and CS3, none of them work! anyone know of a complete one, where i could just drop in new images?

  10. #10
    Junior Member
    Join Date
    Sep 2007
    Posts
    3

    Original Version

    frenzy_rumble,

    You can try http://www.gotoandlearn.com/.

    That is where the original carousel appears.

    The version on this blog is for CS3 only.

    You would need to carefully read the included text file
    in order to set it up correctly.

  11. #11
    Junior Member
    Join Date
    Sep 2007
    Posts
    4
    thanks for the reply. That damn tutorial at that site, he names the instance for the reflection wrong. calls for it's name in the AS later on by a different name. I was like WTF!. but finally got it good.

  12. #12
    Junior Member
    Join Date
    Sep 2007
    Posts
    3

    I know what you mean

    Yes, I know what you mean.

    I noticed that as well.

    In the first tutorial, he names it "ref" and in the second he names it "r".

    I'm glad you were able to figure it out.

    Hope it worked well for you.

    Let me know if you have questions.

  13. #13
    Junior Member
    Join Date
    Oct 2007
    Posts
    3
    Thank you for your carrousel, it seems very powerfull and usefull !!

    However, I have a problem to customize it, if I change the picture size, the icons doesn't appears anymore... I need to put smaller picture of 64x64 instead of 128x128 and it doesn't work.

    Any idea to fix that ?

  14. #14
    Junior Member
    Join Date
    Oct 2007
    Posts
    3
    I there,

    I have another problem, the XML file don't seems to take character with accent (like éèÃ* ...) even with xml file registered as UTF-8.


    Anybody know how to fix it ?

  15. #15
    Junior Member
    Join Date
    Jul 2007
    Posts
    2
    Thank you Gamerflash for a such great script. I just have a couple of questions tho:

    1.- How do I add a URL to the icons?
    2.- How could I modify the script to have the carousel turn right or left and stop at the next icon, thus by hitting an arrow key from the keyboard?


    Cheers.
    - Dan

  16. #16
    11 Years Old Boya
    Join Date
    Apr 2004
    Posts
    61
    NEW UPDATE
    http://shipwar.freepgs.com/carousel/carousel_v1.3.zip

    Always read the readme.txt for details.

    Changes:
    1.3 - October 15
    - changed Carousel function: added container & objectResize
    - added getTitle
    - ability to auto resize to specific size or image size
    - improved depth sorting [thanks Alexander]
    - minor optimization
    - updated demo to show image resize and minor tune up
    - xml format update: added 'title' attribute to help classify the item

    Quote Originally Posted by zmove
    However, I have a problem to customize it, if I change the picture size, the icons doesn't appears anymore... I need to put smaller picture of 64x64 instead of 128x128 and it doesn't work.
    The new version allows you to resize item to either a specified size or its original size:

    var c:Carousel = new Carousel(0, 0, 256, 75, this, "items.xml", {resize: true}); // resize items to image size

    or

    var c:Carousel = new Carousel(0, 0, 256, 75, this, "items.xml", {resize: true, 128, 128}); //resize items to 128x128 pixel EXCEPT movieclip items

    Quote Originally Posted by zmove
    I have another problem, the XML file don't seems to take character with accent (like éèÃ* ...) even with xml file registered as UTF-8.
    Do you mean in the editor or in the carousel tooltips? If its on the tooltip, you need to go to the tooltip movieclip, and select the text object, and click Embed. Then choose Latin1, or you can unselect all to not embed the text.

    Quote Originally Posted by razorholt
    1.- How do I add a URL to the icons?
    2.- How could I modify the script to have the carousel turn right or left and stop at the next icon, thus by hitting an arrow key from the keyboard?
    Update to the newest version and...

    1. You will need to create another function and assign it...
    ie:
    function gotoURL(e:MouseEvent):void {
    var i = e.currentTarget.parent.parent.title;
    navigateToURL("http://domain.com/"+i+".html");
    }
    and in your xml, make the function attribute to 'gotoURL'

    2. I'll include an example later.

    Hope I helped some of you. Enjoy!
    Checkout my site:
    Click HERE
    Checkout my games:
    Oops! No game for now!

  17. #17
    Junior Member
    Join Date
    Oct 2007
    Posts
    3
    Excellent, thank your for your update !!

    To bring more precision on my accent problem, it's in the XML files, character with accent are not showed, I tried to save the file in utf-8 or others, nothing worked.

    Edit : I don't know if it's possible because I need to download the new demo of flash CS3 (because I have the CS2 one), but it is possible to always display tooltip, not only on rollover ?

  18. #18
    Senior Member Gohloum's Avatar
    Join Date
    Aug 2002
    Location
    Florida
    Posts
    185
    Hey, thanks for sharing and supporting this little widget. I will most definately be using it in early 2008 when I start on my next AS3 project. I am sure I will mod the heck out of it and extend the classes. When I do, I will post the modded version back in this thread for everyone.

    I also program Virtools 3D middleware and have a similar interface. What I will do is compare the two and see what features I have and can be brought over into yours. I should be able to look at both and implement new features you may not have thought of.

    Thanks again for sharing!

    TJ
    The Early Bird may get the worm, but the second mouse to the trap gets the cheese...

  19. #19
    Junior Member
    Join Date
    Apr 2008
    Posts
    2

    help needed please

    Hi!

    is there anyone that can share the last version of the carousel_v1.3.zip,
    Gamerflash, it seems that you've made an excellent update of the as2 script to as3, but the downloads links are all dead...
    I've tried myself to convert to as3, but I'm having a lot of difficulties to do so....

    please help anyone ?

    thx

  20. #20
    Junior Member
    Join Date
    Apr 2008
    Posts
    2
    and by the way, is there anyway to add a roolover state that plays a mc, like an animated button?

    thx very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center