By Jonathan on January 11, 2012

Hey folks, been a while since I wrote here but have been very busy doing cool stuff at work ;) This is practically the same example that I wrote on a previous post here, but instead of using Flash and the YouTube data API for AS3, I re-wrote it with jQuery. You may wonder why do the same twice? Well simple, just for the fun of it :P.
I started to do it to get my hands dirty on jQuery, and not just to write some snippets of code, but just to try and re-do something cool.
I used the getJSON() function to parse the JSON feed from YouTube of the most popular videos, a searched video and if you’re watching a video, show related videos. Pretty straightforward. Now I found it pretty much faster than the Flex version and the most popular videos seems to be updated more accurately and faster with jQuery (not sure if it’s a caching or an AS3 data API issue).
Visit the example here, let me know what you think!
I have the source code on GitHub, you can check it out here.
Posted in JavaScript | Leave a Response
By Jonathan on November 25, 2011
Hey all! I know things have been a bit slow in here, (jezz haven’t posted anything in about 2 months!) but I’ve been very busy doing work and playing with some new stuff. Will post details on all those things pretty soon ;)
In the meantime I’ve been (for some time now) trying to create a standard navigation system for my Flash related projects using Robotlegs, something to re-use on every project I get my hands on, just to try to standardize things. I’ve been looking for an easy way to create navigation functionality, to navigate from section “x” to section “y” with ease. Even though the “navigation” itself is NOT something dynamic, I’m not trying to create a Flash-CMS here, just some easy code to re-use to get to the same goal.
So, for most of my project I tend to use the amazing Robotlegs framework, to make my life easier. So, I created a simple Model that holds the current “Section” (this is a Sprite) displayed. In case you wonder, this could be anything, a Sprite or MovieClip whatever you use to display or organize your sections. Bottom line here are the steps in detail:
- By default (or when the application starts) the Model holds the “Home” section.
- When the user clicks a button (this is in a navigation bar) the Model updates to a reference of this clicked Sprite, the Model also holds the previous viewed Sprite (in case you wish to animate it out of the way)
- We’re back to square one, just click another button to update the Model again.
- If you click the same button again, nothing happens.
I could explain it better with code: Here is the Model, currentSection holds the Sprite that is being viewed and changeTo holds the Sprite or “Section” that the user wants to go to:
Here’s the Mediator of the Navigation Bar, sectionChangeSignal is a Signal that get’s dispatched with a click of one of the navigation buttons:
And here’s the Command that updates the Model according to the section that was clicked:
I might implement SWFAddress to this navigation, but didn’t added it because I wanted to use this example whether the target project needs SWFAddress or not.
The whole code is on GitHub you can grab it here. To see a live demo please click here.
Posted in Flash | Leave a Response
By Jonathan on September 22, 2011
Here’s another little snippet of animation with AS3, this one is a square that starts rotating by itself, then with a click on the stage you can see it stop gradually, as if friction is being applied to it. Most like rotating a wheel of fortune wheel. Is an example practice of dynamic animation with Acceleration and friction. You can see a live example here.
Here’s the code:
Posted in Flash | Leave a Response
By Jonathan on September 10, 2011
Lately, I’ve been playing with some Math functions in AS3, especially with Math.cos() and Math.sin(), and while experimenting a little bit with them, created a nice little optical effect using a Sine Wave. Is really nice to find some discoveries now and then. You can see the code below, and you can see it in action here.
Posted in Flash | Leave a Response
By Jonathan on August 30, 2011
This generates a random number for x or y. Crazy isn’t? Tell me about it.
Posted in Flash | Leave a Response