Flash and Silverlight: Explode Image Rotator Flash vs Silverlight: Sponge Image
Sep 01

This is a a Simple Fish Eye Menu (or Dock Menu). The logic is simple and you may further customize it as your own menu. It included both Flash and Silverlight version with complete source codes.

You can find similar resources from ComponentOne as well.

Comparison

Flash implementation: 1 hour
Silverlight implementation: 1 hour
Code variation in the source code:

  • Attach Mouse Event: MouseEvent.MOUSE_MOVE [AS3] vs MouseEventHandler [C#]

Source codes

Flash

Silverlight

Attach Mouse Event: MouseEvent.MOUSE_MOVE [AS3] vs MouseEventHandler [C#]

After you have attached a mouse event handler, you may retrieve the mouse position from the local perspective (e.localX) or from the stage perspective (e.stageX). However, if you would get the position with respect to other movieclip, then you may have to use the method globalToLocal to calculate the values.

// AS3
// make sure the display object is added to the stage
// before calling the stage variable
stage.addEventListener(MouseEvent.MOUSE_MOVE, on_mouse_move);

// mouse event handler
private function on_mouse_move(e : MouseEvent):void{
    // get x
    var localX:Number = e.localX;
    var stageX:Number = e.stageX;
}

Let’s look into case in C#. You must always specific the perspective as a parameter in the GetPosition method. Please also note that if you would like to get the root element, you can retrieve it by reference to Applicatoin.Current.RootVisual.

// C#
this.MouseMove +=new MouseEventHandler(MouseMove);

// mouse event handler
void  MouseMove(object sender, MouseEventArgs e)
{
    // get x with the perspective of this
    double localX = e.GetPosition(this).X;
    double stageX = e.GetPosition(Application.Current.RootVisual).X;
}

Shares and Enjoy~

Did you like this post?

Subscribe here:  

56 Responses to “Flash and Silverlight: Fish Eye Menu”

  1. Andrej Wersilow Says:

    The animation in the Silverlight version runs much more smoothly.

  2. admin Says:

    Yes, actually I think Silvelright has a bettern image rendering than Flash. Anyway, next time, I will use exacly the same images for both application and see if there is really some differences.

  3. nEo.X Says:

    WOW …. SilverLight’s animation is so slick

  4. Alex Says:

    You might need to set “Allow Smoothing” on the bitmaps in Flash so they scale well.

  5. admin Says:

    Thanks for Alex suggesion, I really don’t know there is such a property for imported images.
    But it sad that this property can’t be applied to dynamically loaded images.

  6. mdma Says:

    No wonder Silverlight looks better it is 6 times larger in size!

  7. admin Says:

    mdma, in fact, the zip included the whole silverlight project (also included the silverlight debug files) which makes it larger.

    And it fact, the smooth propertiy is not set in the images of the Flash which makes them look ugly.

  8. Flash Tutorials | Flash and Silverlight Effect | Lemlinh.com Says:

    [...] Read more [...]

  9. unruledboy Says:

    won’t it better more reasonable to change until the mouse is near the objects? I mean the Y aspect. even when the mouse is at the top/bottom of the silverlight object, it also change.

  10. Yo Says:

    Was the Flash Compiled with the default 24fps setting? Cause in Flex and Flash the default frame rate is 24fps, you can increase that to 50 for example and it will be much smoother……

  11. Martijn Croezen Says:

    This comparison isnt really fair.

    The flashfile is compiled at 24 fps, so the flash animation doesn’t run as smooth as the silverlight version. You should change it in your example to reflect the same FPS as silverlight.

    Since you’re not loading in images, you should also turn the smoothing on the images in your library.

    And as far as your comment on not beeing able to turn on smoothing on dynamically loaded images, this is simply not true :)
    For as3.0 take a look at Bitmap.smoothing in the flash helpfile.

    In as2.0 you can simply set myLoadedMovie.forceSmoothing=true after loading your clip with a movieClipLoader.

  12. Sergey Says:

    Why not RC0?

  13. Silverlight Cream for October 05, 2008 -- #388 Says:

    [...] 2 RC0 If you haven’t upgraded to RC0 yet, James Bacon has a step-by-step tutorial for you. Flash and Silverlight: Fish Eye Menu I’m getting close to the bottom of the list of old posts by Terence Tsang… This Fish-Eye menu was [...]

  14. Fish Eye Menu in ActionScript 2.0 | Psyked Says:

    [...] Shine Draw have been kind enough to put a version of this out into the wild, but it’s in AS3 [link]. Of course AS3 is faster and nicer, but there are still some out there who want their stuff [...]

  15. Fish Eye Menu in ActionScript 2.0 | Psyked Says:

    [...] Shine Draw have been kind enough to put a version of this out into the wild, but it’s in AS3 [link]. Of course AS3 is faster and nicer, but there are still some out there who want their stuff [...]

  16. lee Says:

    Much better version in as2: http://actionscriptnotes.com/showcase/macmenu/Main.html

  17. Luis Pedro Ferreira Says:

    In FLEX if we set the framerate to 60 we can see a animation as smoth as we see in SilverLight example, but SilverLight as a beter image render (in my point of view).

  18. Michael Says:

    Nice example.

    I did one of these recently to learn silverlight. Took quite a bit more than an hour, but the part that took the most was that I only got the mouse move events when the mouse was over one of the elements. I eventually solved it by filling the grid with an invisible rectangle. I looked at your page.xaml and see that there’s a gradient behind the icons. Does one really only get mousemove events when the mouse is ‘over something’? If so, could someone point me to where that’s documented so I can read the details?

  19. Domnik Says:

    To Mickael : you can use the mousemove event on the root element (grid or canvas for example), this way you will get code executed each time the mouse moves, whatever object it is on.
    If you need to execute code on an element and it’s ancestors, you can use the handled property.

  20. Bassem Says:

    Great job ;)

    How can we put a link inside each image, “getURL()’??

    Best regards,

  21. Cato Says:

    How can we put a link inside each image, using xaml and c#?

  22. Rolf Says:

    How can I built a click-event for selection of images?

    Thanks

  23. skybot Says:

    哇太好了.终于找到 (skybot) 了谢谢

  24. Nicknitro Says:

    I’ve just looked into it for a few minutes, ’cause it might come in handy:
    The code line to dynamically set smoothing is simple.
    Juste add “.smoothing = true;” to your BitmapData or your Bitmap upon creation.
    Thanks AS3.

  25. tom Says:

    i like it just as much or with mootools or jquery probably more because then i completely eliminate flash and silverlight from the site

  26. Aymiee Says:

    Click Event for selection of images:

    Put the following after the line “_images.Add(image);” in the addImages method:

    FrameworkElement FE = image;
    FE.Tag = i;
    FE.MouseLeftButtonDown += new MouseButtonEventHandler(FE_MouseLeftButtonDown);

    Then add New Event Handler:
    void FE_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
    FrameworkElement selectedItem = (FrameworkElement)sender;
    MessageBox.Show(selectedItem.Tag.ToString());

    }

  27. Simple Fish Eye Menu « JFXStudio: sketch, hack, share Says:

    [...] I came across a nice comparison of Fish-Eye-Menu in Flash and Silverlight. Looks Cool! So thought of writing one in JavaFX and [...]

  28. JavaFX - Fish Eye Menu - Technology Says:

    [...] came across a nice comparison of Fish-Eye-Menu in Flash and Silverlight. Looks Cool! So thought of writing one in JavaFX and [...]

  29. Simple Fish Eye Menu - Use JavaFX Says:

    [...] came across a nice comparison of Fish-Eye-Menu in Flash and Silverlight. Looks Cool! So thought of writing one in JavaFX and [...]

  30. JavaFX - Fish Eye Menu « Rakesh Menon Says:

    [...] Categories: javafx Tags: fish eye menu, javafx I came across a nice comparison of Fish-Eye-Menu in Flash and Silverlight. Looks Cool! So thought of writing one in JavaFX and [...]

  31. Workshopper » Tutorials Navigation Says:

    [...] http://www.shinedraw.com/animation-effect/flash-and-silverlight-fish-eye-menu/ Modified: 1 June 2009 • by admin Created: 26 April 2009 • by admin Categories: hyperliste • navigation Comments: none yet • add one! [...]

  32. Erick Says:

    var image : Bitmap = _images[i] as Bitmap;
    image.smoothing = true;

    You’ll need to set the smoothing property to all your Flash examples for the images being loaded to render smoothly. simple!

  33. dafunker Says:

    Yes, you can do that too in the flash actionscript file :

    var image : Bitmap = new Bitmap(bitmapData, “auto”, true);
    :) No difference between the 2 applications with flash smoothing

  34. sjbgood Says:

    I see in an earlier post instruction on how to add links to the flash Fisheye menu but I can’t seem to get it to work. I don’t even see _images.Add(image); in the source code. Can you please help with adding a link for each image.

  35. Charles Says:

    oh.SHIT

  36. leblanc meneses Says:

    woahh.

    shouldn’t the images get smaller once the hosting container of item controls loses focus?

    do you know any good links to interactive patterns … i’m trying to get better at interaction suttle animation to entice my user interfaces .. a menu control like this is pretty slick .. you plan on doing the hierarchical approach like mac? http://cache.lifehacker.com/assets/resources/2007/06/leopard-desktop-stack.jpg

    to accomplish this the menu will have the top most z-index and container set to auto size based on children … i think that should work

  37. admin Says:

    Hi Leblanc, To accomplish, it’s better to store the stuff in a Canvas and animate their Canvas.Left, Canvas.Top and Canva.ZIndex properties.

  38. flash menu for windows form?? - C# / C Sharp answers Says:

    [...] re: flash menu for windows form?? google bing…never heard of….will be learning about it today…Ya its a inhouse project..i can go for image editing but i wanted to give the carousel menu…something like this : http://www.shinedraw.com/animation-e…fish-eye-menu/ [...]

  39. redeyezombie Says:

    Working great except the ability to link. Can anyone help with linking? Pleeeeeeease?

  40. Sebastiaan Holtrop Says:

    Hi all,

    I’m sorry, but this is not a true fishEye effect, the images aren’t supposed to move over each other, they should be horizontally aligned next to each other, where the larger elements push the smaller ones aside, more like the dock on a Mac. It should simulate a FishEye lens you put on a camera or a peephole in a door.

  41. karol Says:

    Una comparacion pobre, la version en flash esta totalmente mal hecha…

  42. Pedro Says:

    How can we change the images? I’m still a beginner and I have no clue how to do this. Would be great if someone could help. I’m using the flash version.

  43. Pedro Says:

    And linking also would help :D

  44. kirweds Says:

    wats5@mail.ru
    - изготовление сайтов от 30$, баннеров от 10$
    - разослать рекламу на 30000 русскоязычных форумов - 20$
    - рассылка рекламы на 10000 русскоязычных досок - 7$
    - регистрация в 6000 русскоязычных каталогах - 7$
    - рассылка рекламы на 30000 англоязычных форумов - 20$
    -рассылка рекламы на тематические сайты (каталоги,доски и др.) - сбор базы
    + рассылка 60$. Следующие рассылки 10-20$.Собраные базы отдам Вам.
    -ручные рассылки рекламы на любые сайты интернета 0.2$ за каждую регистрацию (не меньше 200 регистраций)
    -рассылка со скидками 100$ -то есть при заказе любых рассылок на общую сумму 150$ скидка 50$ подбор видов рассылок бесплатно
    -комплексная раскрутка сайтов 1000$ разовая + 100$ в месяц за рассылки или по договорености.
    Комплексная раскрутка расчитывалась на минимум 1000 уникальных в сутки,гарантии.
    -E-mai рассылка (только по Вашим базам подписчиков) 20$ на 150000 адресов. Можно на меньшие объемы но не меньше 10$
    -сбор баз любых сайтов или сбор информации.
    Изготовление сайтов, интернет-магазинов как на готовых шаблонах так и на шаблонах “с ноля”.
    На сайт могу поставить аудио,видео,слайдшою,формы связи,регистрацию,фотогалерею,форум,
    гостевую,чат,блоги и другие модули.Можно с панелью администратора и без.Можно заказать простые
    сайты 1 - 5 страниц текста с рисунками 10$-30$ есть более 100 простых шаблонов.
    - Много лицензионных программ (тысячи).
    wats5@mail.ru

  45. reldaks Says:

    wats6@mail.ru
    - изготовление сайтов от 30$, баннеров от 10$
    - разослка рекламы на 30000 русскоязычных форумов - 20$
    - рассылка рекламы на 1000 русскоязычных интернет досок - 7$
    - регистрация в 6000 русскоязычных каталогах - 7$
    - рассылка рекламы на 30000 англоязычных форумов - 20$
    -рассылка рекламы на тематические сайты (каталоги,доски и др.) - сбор базы
    + рассылка 60$. Следующие рассылки 10-20$.Собраные базы отдам Вам.
    -ручные рассылки рекламы на любые сайты интернета 0.2$ за каждую регистрацию (не меньше 200 регистраций)
    -рассылка со скидками 100$ -то есть при заказе любых рассылок на общую сумму 150$ скидка 50$ подбор видов рассылок бесплатно
    -комплексная раскрутка сайтов 1000$ разовая + 100$ в месяц за рассылки или по договорености.
    Комплексная раскрутка расчитывалась на минимум 1000 уникальных в сутки,гарантии.
    -E-mai рассылка (только по Вашим базам подписчиков) 20$ на 150000 адресов. Можно на меньшие объемы но не меньше 10$
    -сбор баз любых сайтов или сбор информации.
    Изготовление сайтов, интернет-магазинов как на готовых шаблонах так и на шаблонах “с ноля”.
    На сайт могу поставить аудио,видео,слайдшою,формы связи,регистрацию,фотогалерею,форум,
    гостевую,чат,блоги и другие модули.Можно с панелью администратора и без.Можно заказать простые
    сайты 1 - 5 страниц текста с рисунками 10$-30$ есть более 100 простых шаблонов.
    - Много лицензионных программ (тысячи).
    wats6@mail.ru

  46. kerbets Says:

    gfd23@mail.ru
    - изготовление сайтов от 30$, баннеров от 10$
    - рассылка рекламы на 30000 русскоязычных форумов - 20$
    - рассылка рекламы на 1000 русскоязычных интернет досок - 7$
    - регистрация в 6000 русскоязычных каталогах - 7$
    - рассылка рекламы на 30000 англоязычных форумов - 20$
    -рассылка рекламы на тематические сайты (каталоги,доски и др.) - сбор базы
    + рассылка 60$. Следующие рассылки 10-20$.Собраные базы отдам Вам.
    -ручная рассылка рекламы на любые сайты интернета 0.2$ за каждую регистрацию (минимум 200 регистраций)
    -рассылка со скидками 100$ -то есть при заказе любых рассылок на общую сумму 150$ скидка 50$ подбор видов рассылок бесплатно
    -комплексная раскрутка сайтов 1000$ разовая + 100$ в месяц за рассылки или по договорености.
    Комплексная раскрутка расчитывалась на минимум 1000 уникальных в сутки,гарантии.
    -Рассылка на E-mail (только по Вашим базам подписчиков) 20$ на 150000 адресов. Можно на меньшие объемы но не меньше 10$
    -сбор баз любых сайтов или сбор информации.
    Изготовление сайтов, интернет-магазинов как на готовых шаблонах так и на шаблонах “с ноля”.
    На сайт можно поставить аудио,видео,слайдшоу,формы,регистрацию,фотогалерею,форум,
    гостевую,чат,блоги и другие возможости.Можно с панелью администратора и без.Можно заказать простые
    сайты 1 - 5 страниц текста с рисунками 10$-30$ есть более 100 простых шаблонов.
    - Много лицензионных программ (тысячи).
    gfd23@mail.ru

  47. gepinks Says:

    metov64@mail.ru
    - изготовление сайтов от 30$, баннеров от 10$
    - разослать рекламу на 30000 русскоязычных форумов - 20$
    - разослать рекламу на 1000 русскоязычных интернет досок - 7$
    - регистрация сайта в 6000 русскоязычных каталогах - 7$
    - разослать рекламу на 30000 англоязычных форумов - 20$
    -рассылка рекламы на тематические сайты (каталоги,доски и др.) - сбор базы
    + рассылка 60$. Следующие рассылки 10-20$.Собраные базы отдам Вам.
    -ручная рассылка рекламы на любые сайты интернета 0.2$ за каждую регистрацию (минимум 200 регистраций)
    -рассылка со скидками 100$ -то есть при заказе любых рассылок на общую сумму 150$ скидка 50$ подбор видов рассылок бесплатно
    -комплексная раскрутка сайтов 1000$ разовая + 100$ в месяц за рассылки или по договорености.
    Комплексная раскрутка расчитывалась на минимум 1000 уникальных в сутки,гарантии.
    -Рассылка на E-mail (только по Вашим базам подписчиков) 20$ на 150000 адресов. Можно на меньшие объемы но не меньше 10$
    -сбор баз любых сайтов или сбор информации.
    Изготовление сайтов, интернет-магазинов как на готовых шаблонах так и на шаблонах “с ноля”.
    На сайт можно поставить аудио,видео,слайдшоу,формы,регистрацию,фотогалерею,форум,
    гостевую,чат,блоги и другие возможости.Можно с панелью администратора и без.Можно заказать простые
    сайты 1 - 5 страниц текста с рисунками 10$-30$ есть более 100 простых шаблонов.
    - Много лицензионных программ (тысячи).
    metov64@mail.ru

  48. JavaFX – Fish Eye Menu « Rakesh Menon Says:

    [...] came across a nice comparison of Fish-Eye-Menu in Flash and Silverlight. Looks Cool! So thought of writing one in JavaFX and [...]

  49. alymo69 Says:

    HELP!

    Hi,

    i loved this fish eye menue. But i have one problem. I don´t have any expirience with flash. I hope somebody can help me. See in my website: http://www.wazir-tobacco.com. On the top i want to put this menue with this 6 pictures. (i can be 7 too). But i don´t know how to chance the position of the objects and how to bring the size on this i need???!!!

    Please i need urgent help in this topic…

    Thanks.

  50. mersant Says:

    Предлагаю рассылки рекламы:
    - на форумы 20$ на 30000 форумов
    - регистрация в белых каталогах сайтов 10$ на 6000 каталогах
    - на доски бесплатных объявлений интернета 15$ на 20000 досок
    - ручная рассылка рекламы в любые ресурсы 0.2$ за регистрацию, сбор сайтов входит в стоимость.

    E-mail:rot789@mail.ru

  51. namegoeshere Says:

    Great, but without the ability to link anywhere, it is pointless.

  52. spam-dev Says:

    thank for silverlight code.

  53. SUDAKA Says:

    Hello Guys
    I made some Changes to this application :::
    – I added a Smoothing
    – I added a REFLECT class in AS3 of course
    – I insert each image inside a MovieClip, so that reagise as a Button….
    you can download a SOURCE

    http://www.davidmanrique.be/blog/?p=96

    — Thanks a lot SHINEDRAW

  54. MV Says:

    How do we change the pictures from the default icons that are there?

  55. Mike Palmer Says:

    ShineDraw,

    I have a much smoother rendering of the images in Flash AS3 using image.smoothing=true; inside the on_mouse_move and addImages private functions.

    Kind Regards,

    Mike Palmer.
    Webmaster.
    Brand-Rex Ltd.

  56. Josh Parker Says:

    Animation of Silverlight looks so good.

Leave a Reply