Running out of time with LiquidText
Jensa suggested the idea and I couldn’t resist.
|
|
||||||||||||
|
||||||||||||
Running out of time with LiquidTextFebruary 11th, 2008 . by polyGeek
Jensa suggested the idea and I couldn’t resist. similar posts LiquidText exampleFebruary 11th, 2008 . by polyGeek
I’m about to rewrite my LiquidText class in AS3 but first I thought I’d apply some of the code optimizations to the AS2 version and add some API calls to adjust settings just in case someone wants to use it. Here’s an example of it in action below [ download FLV | download LiquidText.as ]
Essentially, what LiquidText does is it takes the text that you give it and breaks it down into an array of the individual words. It then finds a place where it can put the first word within the area that you specify without hitting any of the shapes that it wraps around. Then it places the following words until it runs out of space on that line. Then it wraps to the next line and starts the process over again. If something here has proved valuable to you then feel free to drop a couple of bucks in the tip-jar.similar posts Taking my cars for a spin with Actionscript 3.0August 12th, 2007 . by polyGeek
These cars were design in the Forza2 racing game for the XBox360. First off let me give credit where credit is due. I did not do the designs on the polyGeek car or the Seahawks car. That was done by Lee Nicholls the Global Solutions Director for Getronics, World domination hobbyist, woo-er of beautiful women, driver of outrageously fast cars, and Forza2 designer extraordinar. You can view the source code here. ( The download zip is a little over a meg because I left in the images of the Adobe Fararri for you to play with.) I’ve commented the code pretty thoroughly so I don’t think there’s much point in going into details. I’ll just give a quick overview of how this works. First off, there are XML files that describe a series of images. The code goes through and loads each image and places them one on top of the other. As soon as all the images are loaded it runs through the series of images to display them each in turn giving the illusion of the car, or whatever you have photos of, rotating. That’s serves the purpose of letting the user know that they can rotate through the images. Just displaying a mouse-hand probably isn’t enough of an indication. The mouse wheel also works to scroll through the images. The images are loaded one after the other instead of all the requests going out at once. I found that there were some odd errors with making a request for 40 images all in one shot. Sometimes they would load and sometimes they wouldn’t. Loading in sequence solved all that. As your drag your mouse across the image space it uses the width of the image and the number of images in the stack to calculate how much you need to drag your mouse before the next image displays. That way if you start from one side of the image space and drag all the way across it will rotate through all of the images. No matter how many there are. Modulo to the resuce There are few occasions to use modulo in Actionscript. That’s the mathematical operation using the “%” sign. Modulo gives you just the remainder after division. Example: 34 % 10 = 4 because 10 goes into 34 three times with 4 left over. Modulo was very handy for solving an otherwise messy problem. References to each image are stored in an array. As you drag your mouse across the image space the code figures out which image needs to be visible at that point. So what happens if the user is dragging through the last few images in the array and then needs to start back at the beginning of the array? You can imagine lots of messy if() statements to handle all that or, I can just take the modulo of the image I think they need to see with the length of the array and they will always see the correct image. Example: suppose there are 30 images in the array ( 0-29). The user is dragging across the image space and displaying the last few images, 27, 28, 29, 30 . . . But there is no image 30. But if when I go to display an image I use the calculated image number modulo 30 ( length of the array ) then I’ll always be in the range of the image array. So when I try to display image 30 I’ll get 0, and for 31 I’ll get 1 and so forth. Problem solved and no messing if() statements. If something here has proved valuable to you then feel free to drop a couple of bucks in the tip-jar.similar posts XanaduWest.comDecember 6th, 2006 . by polyGeek
XanaduWest has quite a few features that are very rare for a Flash RMA. Firstly, it is bookmarkable. As you browse through the photos the Actionscript is communicating with the browser via Javascript to make updates to the location bar – window.location.hash. If you are looking at a particular photo and bookmark the page or copy the URL and email it to someone then they will come to the very same photo. As the page loads it looks for any arguments added onto the URL. If they are there then the data there is used to load the corresponding photo. Otherwise it randomly picks a category/subcategory to display. There is an email feature here that uses the same URL code so that you can email a group of photos to someone. When they click on one of those photos it will bring them straight to the one they are looking at. The navigation and all photo data are contained in an XML file. So if I want to add a photo to a gallery or create a whole new gallery then I don’t need to make any changes at all to the Flash file. All I need to do is add a few lines to the XML, upload it and the photos to the server and I’m done. To make things even easier on myself I used the DrawingAPI in Flash to make all the frames around the photos. That saves a lot of work later on Photoshop. So that frame with the beveled edges is all just lines drawn programmatically in Flash. Lastly, I have used LocalObjects to store data about the current state of the RMA. If you change the volume level of the music it will be remembered when you return. It also checks to see which photos have been stored to be emailed. If you leave and return those same selected photos will be there ready for you to email to yourself or a friend. This functionality can easily be extended to become a shopping cart if I ever decide to sell prints again. And please, stay long enough to see the sunset. People say that it’s beautiful. If something here has proved valuable to you then feel free to drop a couple of bucks in the tip-jar.similar posts Xbox HardwareDecember 6th, 2006 . by polyGeek
Brian Pember and Jason Gold did the design together while Brian did the work of putting it all together in Flash. I was just there to help Brian enable some of the more dynamic aspects, such as using XML for the data, helping with the navigation, and the internationalization of the dynamic text fields. That is one of the things that I like most about my position with Xbox. When it comes to Flash and Actionscript if something doesn’t work or someone doesn’t know how best to tackle a problem they call me. We talk it over, work it out and make it happen. I think they call that teamwork. If something here has proved valuable to you then feel free to drop a couple of bucks in the tip-jar.similar posts |
|
|||||||||||
|
© Copyright 2008 polyGeek.com / Dan Florio, All Rights Reserved Except Where Explicitly Stated M2 Websites Local Directory for Los Angeles, CA Better Tag Cloud |
||||||||||||