NEWS: Spongebob squarepants ringtone Juggernaut bitch ringtone I90c nextel ringtones Banana phone ringtone Rfee ringtones Free sms ringtones Free wav ringtones Free ringtones for my prepaid 3390 nokia Mp3 ringtone creator 3586i cellular nokia ringtone us Unlimited ringtones Free sprint pcs cell phone ringtone? My humps ringtone Free phone ringtone screensaver sprint Green day ringtones V550 ringtones? South park real ringtones Downloadable ringtones for sprint phones Free verizon ringtone Free motorola v60i ringtone. Ringtones cingular Cell free pcs ringtone sprint! Ringtones for alltel cell phones Hawk nelson ringtones? Ringtones for nokia 2128i Free motorola v120e ringtone? Free lg vx3200 ringtone Cingular hills ringtone! V551 mp3 ringtone Ericsson keypress ringtones 3585i alltel nokia ringtone Jamie fox ringtones Kill bill ringtone Nextel ringtone loader software? Free polyphonic ringtones Download free mobile ringtone virgin: New zealand ringtones Nextel ringtone program 3g free ringtone Download ringtone for nokia phone free Download free motorola ringtone v300 Free v60 ringtone Treo 650 ringtones Oldies ringtones: Free voice ringtone Free polyphonic ringtones for sage myc 2 Ringtones for cingular phone Free metro ringtone Blackberry 7290 ringtones Free ringtone for a sanyo 4900 sprint phone: Nickelback real ringtones Free lg lx5450 ringtone Free nokia 1100 ringtones Fre ringtones Free ringtones for virgin mobile cell phones Nextel i860 ringtone software! Free verizon wireless ringtone Ringtone for verizon lg Blackberry 7250 ringtones com Free wav ringtone Download free ringtone for verizon wireless Free ringtones for a motorola 120t Verizon lg ringtones, Free imelody ringtones I870 ringtones: Kylie minogue ringtones Free sidekick ringtones Siemens a50 ringtones Lg 8100 losing ringtones. From first to last ringtones Composer ringtones for motorola Contemporary christian ringtones Cingular make your own ringtone Free lg vx3200 ringtones Compose ringtones Free downloadable ringtones Nextel ringtones cd! Blackberry ringtones Free motorola v60i tracfone ringtone Final fantasy 7 ringtones Cell free phone ringtone verizon! Free suncom ringtones New found glory ringtones! Free ringtone downloads nokia 8600 audiovox ringtone Ringtones for motorola razr Imperial march polyphonic ringtone. Nextell ringtones Code free motorola ringtone Free nokia polyphonic chart ringtones Free nextel ringtone program Cellular download free phone ringtone Cingular wireless ringtones Black cingular eyed pea ringtone Free nextel mp3 ringtone Real music ringtones Creed ringtones Free pcs phone ringtone sprint Download free motorola phone ringtone Navy ringtones Free ringtone for verizon lg tm510 Composer motorola ringtone Free kyocera polyphonic ringtones Seinfeld ringtone Free indian music ringtones, Free ringtones for virgin mobile cell phones Keypress motorola ringtone? Motorola keypress ringtones 1100 free nokia ringtone Bitter sweet symphony ringtone Phones mobile ringtone converter mp3 ogg amr mmf wav Cingular ringtone downloads 8200 free ringtone sanyo sprint Free polyphonic ringtone Iron man ringtone? Prince ringtones Free phone ringtone sprint voice Motorola v265 ringtones Cincinnati bell ringtones? Free download ringtones Blackberry 7520 ringtones Free download cell phone ringtones Verizon wireless free music ringtone Free phone ringtone wallpaper Illegally download ringtones Downloadable ringtones for cingular Motorola ringtones Us cellular ringtones Free treo 650 ringtones Ringtone galore Ringtone download Free ringtones for alltel cell phones Free hifi ringtones Mp3 mobile ringtone Green day ringtones Download ringtones mp3 Free polyphonic ringtones Free motorola v60i keypress ringtone Motorola v120 cell phone ringtone codes. Free ericsson ringtones Ringtone uploader Dragostea din tei ringtone Boostmobile ringtones Cellular free phone ringtone wallpaper Verizon wireless free downloadable ringtone. Christian ringtone Evanescence ringtone Here we go ringtone Motorola v170 tracfone ringtones. Free ringtones sent through text messages Free ringtone for motorola v60i Ree ringtones Dream theater ringtones Texas country real ringtones Indian ringtones Ringtones for panasonic model kx tga520 cordless phone Anime ringtones Free us cellular ringtone Download free ringtone motorola v60i! Cingular free ringtone Polyphonic ringtone creator Nokia 1100 composer ringtones Free icp ringtones Magnum pi ringtone Motorola v170 composer ringtones Nokia ringtones Beverly hills cop theme ringtone Ringtone graphic Kylie minogue ringtones Usa motorola v60i ringtones Polyphonic ringtones for sidekick: Keypress ringtones for samsung Download free gospel ringtone: Motorola v60s ringtones Ringtone Free ringtones motorola Download i730 nextel ringtone software Free ringtones from the internet to your phone Nextel ringtone uploader Eric prydz ringtone Avenged sevenfold ringtones Free nextel ringtone loader Inner circle ringtones! Cingular ringtone Sound effect ringtones! Scotty doesn't know ringtone Free ringtone sent to cell phone: Cingular ringtone and wallpaper Free polyphonics ringtones Free lgvx6000 ringtone verizon Download pcs ringtone sprint! Animal ringtones Ringtones for tmobile Free music ringtone for verizon Keypress ringtones motorola, Nextel ringtones cd The used nokia composer ringtones, Pocket pc ringtones Free ringtones for cincinnati bell phones Cinglar ringtones Free audiovox 8610 ringtones and games Wild turkey ringtones Alltel ringtones? Free nokia 3310 ringtone True tone ringtones Listen to ringtones Arabic download free ringtone Ericsson t68 ringtone composer Sharp gx10i ringtones Free ringtone for verizon samsung phone Free verizon lg vx6000 ringtones Hifi ringtones Free ringtones for sprint phones Real mp3 ringtone Free nextel ringtone converters? Ringtone for motorola Nokia 3510i ringtones Motorola ringtones Ringtones nokia Nokia 6030 ringtones Create ringtone Tech n9ne ringtone Free i870 nextel ringtone 8600 audiovox ringtone Download free motorola ringtone v300 Lil wayne ringtones Free ringtone for your cellular one phone Free nextel ringtone converter Download ringtones for my cell phone Free polyphonic ringtones for sprint pcs Prepaid ringtones Download free midi ringtones Free ringtones for verizon phones A300 ringtones Latest hip hop rap ringtones. 5300 free ringtone sanyo sprint Original motorola ringtones htm Trace adkins ringtones Free ringtones no clubs to join Pink panther ringtones: Tv show ringtones Free chinese ringtones Hat dance ringtone T300 ringtones, com Free ericsson ringtones Muppet ringtone Simple freedom ringtones, Reggaeton ringtones Motorola ringtone Nextel midi ringtone Motorhead ringtones Motorola v300 ringtones Mp3 ringtones. Buy cingular ringtone Nextel wav ringtone Nextel ringtones cd wallpaper Single beep ringtone Star wars mp3 ringtone Verizon ringtone downloads, Free ringtone for sprint vision phone Imperial march ringtone Boost mobile ringtone maker Juggernaut bitch ringtone Shinhwa ringtone Futurama ringtone Free motorola 120t phone ringtones True tone ringtones: Cingular samsung ringtone Reg reagan ringtones Free polyphonic ringtones for sagem myc 2 Nextel ringtone downloads Tool ringtones Free audiovox 8910 ringtones Free ringtone wallpaper Free cellphone ringtones, V551 mp3 ringtone Metallica ringtones Ohio state ringtones Free downloadable motorola v60i ringtone Nightwish ringtones Nokia 3120 ringtone Web site for nextel ringtone Ringtones for cingular phone Free lg lx5450 ringtone Free ringtones for sprint pcs Free tamil ringtones Motorola ringtone tracfone v60i Samsung a650 ringtones Alltel ringtone wireless Free mary j blige ringtones for nokia phones Cell free phone prepaid ringtone Razor ringtones Ringtones for nokia phones Download free ringtone motorola v60i V3 ringtones Ringtones composer Free composer motorola c350 ringtones Free motorola v60i ringtone Arac free ringtone sprint Ringtone loader 24 ctu ringtone, E105 free ringtone samsung Free ringtones for a motorola phone Verizon compatible ringtones Sidekick ii ringtones Polyphonic ringtones Ringtone crazy frog The godfather ringtone for blackberry Free cellular phone ringtone downloads Cricket download free ringtone Ringtones alltel Sidekick ii ringtones Midi ringtones motorola Free phone ringtone Download free music real ringtone? Nextel ringtones Free phone prepaid ringtone verizon wireless, Ringtones for nokia 3220 free Free ringtones no commitment or no club to join Bhangra ringtones 24 ctu ringtone Ringtones samsung x427m Free ringtones for verizon wireless Ringtones for prepaid cell phones Virgin mobile phone ringtone? Cellular ringtones Rap ringtones Ringtone affiliate program Free polyphonic ringtones for nokia phones Sony ericsson composer ringtones Blackberry 7100i ringtones Free ringtones wit the words wit it Free ringtones nextel Composer hindi ringtone How to make your own ringtones. Download ringtone for nextel i830 Nextel ringtone with webjal. Sanyo 8100 ringtone Motorola voice ringtone Mp3 real music ringtones Ringtones for cellular south, Sprint ringtones free Create your own ringtone? 3588i free nokia ringtone sprint Weezer ringtones. Rent music ringtones Cellular music ringtones Polyphonic ringtone download Christian cell phone ringtones Verizon lg vx5200 ringtones Free virgin ringtones Free ringtones for a motorola v60i Absolutely free pcs ringtone sprint Real music ringtones Compose your own ringtone Baby laughing ringtone Motorola t720 keypress ringtone Ringtone mp3 download Linkin park ringtone Nextel i860 ringtones Sweet home alabama ringtone nokia Free motorola phone ringtone verizon Best ringtones for cell phones Download free sprint ringtones Nokia 1108 ringtones! Ringtones for tracfones Jack johnson ringtones Firefighter ringtones Create cingular ringtone Free polyphonic ringtones for sprint pcs Full metal jacket ringtones Ringtones for samsung x427m Cingular real ringtone Ringtones com Free download ringtones cell phone Free composer ringtone Free ringtone for motorola v330, Download ringtone for cellular one Ringtones for nextel phones, Code free motorola ringtone Cellular free kyocera phone ringtone No internet required ringtones Ringtones compatible with verizon: Sony ericsson t68i ringtones Free real music ringtone sprint. Motorola tracfone ringtones v60i Metro pcs ringtone Phones with mp3 ringtones Free ringtones to sprint cell phone Free boost ringtones Ringtones for sprint cell phones? Ringtones downloads Ringtone converter Spongebob squarepants ringtone Free hindi song ringtones? Cingular ringtone treo Wicked the musical ringtones Free nokia mobile ringtones Sony ericsson free real ringtone Free ringtone for cellular one cell phone Free downloadable ringtones and logos Sailor moon ringtones Stairway to heaven ringtone Alltel audiovox ringtones Motorola v120 ringtone. Ludacris ringtones O zone music ringtones 100 free ringtone sprint Free motorola ringtones keypress?

generalrelativity

Rendering FOAM

I’m sorry that this took so long- especially those of you who’ve written me and patiently waited for my help with rendering… I simply don’t have as much time as I would like. Anyway- this will offer a solution for rendering your FOAM physics simulation with:


Here’s a very silly demo- Mouse down anywhere to switch from the DisplayObject renderer to the Bitmap renderer.

demo
source

Note that these new renderers are meant as example only- I do think in most cases the developer will need a more specific setup than I could hope to generically offer. So consider this my implementation and at best a nudge in the right direction.

Hopefully both of these will be fairly self-explanatory, but I’ll briefly go over the DisplayObject renderer and what my thinking was when addressing this issue.

I wanted a means to render a DisplayObject (base class of Sprite, MovieClip etc.) that’s the visual representation of a RigidBody being simulated. I knew that I’d like to be able to pass either the DisplayObject’s Class or the instance itself. I also knew that I’d need an easy way to adjust the position of the DisplayObject- so first, I wrote a datatype to hold these properties- DisplayObjectData.

You’ll see that it has a setter for defining its displayObject property. This is what facilitates passing either a DisplayObject Class or a DisplayObject instance. The other properties:

  • offsetX - the amount to offset the DisplayObject from its origin in the x direction
  • offsetY - the amount to offset the DisplayObject from its origin in the y direction
  • autoCenter - Boolean indicating whether to center the contents about the origin- Because of the way a RigidBody rotates about its center of mass, I figured this would be typical.
  • hasBeenDisplayed - a helper Boolean for determining whether to perform the indicated transformations

In Rocket.as, you can see the way I’m embedding my visual assets:

Actionscript:
  1. [Embed(source=“../../../bin/images/rocket/lunarPod.png”)]
  2. private var rocketSpriteClass:Class;
  3.  
  4. [Embed(source=“../../../bin/images/rocket/asteroid.png”)]
  5. private var asteroidSpriteClass:Class;

If this is unfamiliar with you, simply note that it’s analogous to the classes you’re instantiating as MovieClips in Flash CS3. As you’ll see in a moment, it’s not necessary to pass the Class, we can pass the DisplayObject instance as well.

Here’s how I’m passing the class to FOAM to tie it to to a RigidBody. Note that the instance of DisplayObjectData simply defines Foam.addElement’s renderData argument.

Actionscript:
  1. foam.addElement( rocket, true, true, new DisplayObjectData( rocketSpriteClass, 0, -5 ) );

Compare this with how I’m creating the asteroid (I wanted to scale the asteroid, or else I’d have created it in the same way as the rocket- it worked out well for the purpose of demonstration):

Actionscript:
  1. var asteroidSprite:DisplayObject = new asteroidSpriteClass();
  2. asteroidSprite.scaleX = asteroidSprite.scaleY = size / 64;
  3. var asteroid:Circle = new Circle( sx, sy, size, size * 4, svx, svy, 0.5, 0.25, 0, -0.1 + Math.random() * 0.2 );
  4. foam.addElement( asteroid, true, true, new DisplayObjectData( asteroidSprite ) );

There’s one last important thing to note in the Rocket example class. Because I don’t want to use the default FOAM renderer, I have to tell it which renderer to use:

Actionscript:
  1. foam.setRenderer( new DisplayObjectFoamRenderer() );

Now let’s move on to DisplayObjectFoamRenderer. Note that I’ve chosen to extend SimpleFoamRenderer so that I don’t have to rewrite drawing routines for objects I don’t have graphics for (such as the mouse dragger bungee). You’ll see my use of the DisplayObjectData properties in the addRenderable method.

So- ultimately all of this boils down to 3 lines of code which line up our DisplayObject with our RigidBody:

Actionscript:
  1. displayObject.x = ISimulatable( renderable.element ).x;
  2. displayObject.y = ISimulatable( renderable.element ).y;
  3. if( renderable.element is IBody ) displayObject.rotation = IBody( renderable.element ).q * 180 / Math.PI;

It places the DisplayObject at the x and y coordinates of the RigidBody’s center of mass. Because rotation is given in radians, we have to convert to an angle which is what DisplayObject.rotation expects.

And that’s pretty much it; for the most part a FOAM renderer is bookkeeping. It might suit you far better to just maintain reference to your DisplayObject and update it every frame just as I am in the above 3 lines of code… simply set render to false in Foam.addElement.

11 comments

Modeling Simple Orbit with FOAM

This article walks through my implementation of modeling orbit with FOAM. The content lays a groundwork which could be used to simulate (a ridiculously simplified version of) our solar system for instance. It has 2 main goals:

  1. Give the reader a solid and quick understanding of how one might use FOAM specifically.
  2. Exemplify the difference between differential equation solvers.

demo

Orbit Demo
FOAM source

When wanting to create physically realistic animation using FOAM, the first step will often be deciding how to develop the forces required to create the desired motion. Forces in FOAM are primarily handled via modular implementations of IForceGenerator- which simply dictates that the method generate generates a force for its passed element. Gravity in the context of our atmosphere and friction are 2 force generators included in the source.

But how would we go about modeling the force an extremely massive object exerts on another?

Firstly, we need to define an equation which ultimately yields a force that we can apply. Newtonian gravity offers the simple force equation:

gravitational force equation

  • F is the force we’re solving for
  • G is a gravitational constant
  • m1/m2 are the masses of the bodies in question
  • r is the distance between the bodies

It should be clear from looking at this equation that the larger the mass, the shorter the distance, the greater the force- which is about as complex as we need to go to get realistic looking results. One simplification we’ll make is assuming that the body exerting the gravitational force is so much larger than the body being acted on, that we can neglect the force acting back on it.

This is simple enough, but we need to translate Newton’s equation into a form our physics engine can execute- We need to create a new force generator. We’ll look at what’s going on in its constructor and generate method; the class in its entirety can be found here.

First, the constructor takes the element we want to exert the force and gravitationalConstant- this is a magic number that should be tweaked per simulation:

Actionscript:
  1. public function GravitationalForceGenerator( source:ISimulatable, gravitationalConstant:Number = 1.2 )
  2. {
  3.    this.source = source;
  4.    g = gravitationalConstant;
  5. }

I’ve left out some error checking for the sake of brevity here- reference the complete class. Next we implement generate:

Actionscript:
  1. public function generate( element:ISimulatable ) : void
  2. {
  3.    //find the difference vector
  4.    var diff:Vector = source.position.minus( element.position );
  5.    //add our solved force along the difference vector to the supplied element
  6.    element.addForce( diff.getUnit().times( g * source.mass * element.mass / diff.dot( diff ) ) );
  7. }

Line 6 contains our equation for universal gravitation as discussed above. The change worth noting here is that the force is applied in the direction of the exerting body (GravitationalForceGenerator.source). We do this by normalizing the bodies’ difference vector, and scaling it by the force found in Newton’s equation. Note also that the dot product of a vector and itself is its squared magnitude- this is how we’re finding the square of the bodies’ distance- the equation’s right-hand side denominator.

Now let’s look at how I’ve used this force generator in the context of a FOAM application. Remember that we’re also going to examine the difference between IODESolvers.

Actionscript:
  1. //create a source of the gravitational pull
  2. var source:Circle = new Circle( 400, 300, 60, 10000 );
  3.  
  4. //create an element influenced by source’s gravitational pull to be integrated with the Euler IODESolver
  5. var eulerOrbital:Circle = new Circle( 700, 300, 30, 100, 0, -7 );
  6. //create an element influenced by source’s gravitational pull to be integrated with the RK4 IODESolver
  7. var rungaKuttaOrbital:Circle = new Circle( 700, 300, 30, 100, 0, -7 );
  8.  
  9. //create the gravitational force generator
  10. var gravity:GravitationalForceGenerator = new GravitationalForceGenerator( source );
  11.  
  12. //add this to each orbital
  13. eulerOrbital.addForceGenerator( gravity );
  14. rungaKuttaOrbital.addForceGenerator( gravity );
  15.  
  16. //add each element to FOAM (no collisions)
  17. foam.addElement( source, false, true, { color:SimpleOrbit.SOURCE_COLOR, alpha:1 } );
  18. //specify the use of our Euler solver
  19. foam.addElement( eulerOrbital, false, true, { color:SimpleOrbit.EULER_COLOR }, new Euler( eulerOrbital ) );
  20. //RK4 is default, no need to explicitly set
  21. foam.addElement( rungaKuttaOrbital, false, true, { color:SimpleOrbit.RK4_COLOR } );

The important aspects here are:

  • we create a new GravitationalForceGenerator and add it as a force generator to each of our orbiting bodies, setting our source Circle as its source.
  • the orbitals are created with identical masses, positions and initial velocities (tangent to desired orbit at location)
  • one orbital gets added with FOAM’s default solver, RK4- the other with an explicitly defined Euler solver.

The whole SimpleOrbit class can be found here.

If you take a look at the demo, you’ll notice that slowly but surely the orbital being integrated with our Euler solver drifts out of desirable orbit. It will continue to spiral outward. If we set the number of iterations we allow the engine to use per frame to 1, you would see that this error accumulates faster. If instead, we set the iterations to 100 for instance, its orbit would match the more precise RK4-integrated orbital much longer.

So why is this happening? To better explain, I’ll steal some images and description from an earlier post of mine- reference the Euler and RK4 classes also.

At every step in time in which we evaluate state and derivative, the forces acting on our orbiting bodies is different. If we were able to do this evaluation an infinite number of times every frame, Euler would provide the correct answer. This is obviously impossible and so even though the forces acting on the body continually change, we’re limited to apply the force found at a single moment in time across the entire interval over which we’re integrating.

The line segment piercing the starting point represents the derivative. Because Euler simply advances the equation via this derivative, it should be easy to see why it is so error prone. Compare this with how RK4 works:

Because it uses the slope at multiple points over the interval to evaluate the ultimate derivative, our approximation using RK4 is entirely more accurate. This accuracy comes at a cost- RK4 is very much more expensive to calculate- although if you tried the different iteration suggestion I made, you’d see it is more accurate at 3 iterations than Euler is at 100. This is one of FOAM’s strong points- it lets you choose the solver best suited for a specific task within a simulation.

Hopefully this has been helpful in understanding both how to solve a problem with FOAM and what the different integrators are useful for. Future releases will include many more solvers.

Sorry for the super lame demo graphics- another early article will detail the implementation of a decent FOAM renderer.

8 comments

FOAM Update

Re-zipped up the source after making numerous bug fixes and adding a new example. This fixes the clumsy, problematic way I was removing elements across the board. Check it out here.

I also put the documentation up on my server and will keep it up-to-date.

No comments

FOAM Rigid Body Physics Engine Alpha Release 0.1

FOAM logo

I’ve been working on FOAM off and on in my spare time for the past few months. Recently I’ve been working on solving constraints on a global level- which is no easy task. I decided to work laterally for a bit and get a release out.

FOAM is primarily intended as a resource for developers interested in simulating physics. It has a carefully thought out OOP structure and modular design. A savvy developer should have no problem extending and repurposing FOAM to his own ends. The Foam datatype is in fact not a physics engine but an interface for simulating physics. It offers a simple means to create, control and run a simulation- it purposefully keeps the more nitty gritty, behind-the-scenes operations shielded from the casual developer. A physics engine is simply part of its composition.

I think the best way to use FOAM as a resource for creating physics simulations is to look through the source. I did a decent job commenting and use fairly descriptive variable names. When I set out working on simulating rigid body physics, I didn’t find one comprehensive resource- an article would be helpful here, a tutorial there, but then the matching source would be a comment-less single-letter-variable mess. Also- not coming from a mathematical background, the often obtuse-sounding descriptions in articles can be daunting. In practice, seemingly complex equations can translate to very simple algorithms in the world of computers. I hope that FOAM bridges some of these gaps.

Over the next few weeks, I’ll be posting tutorials and examples- Please let me know of anything that interests or confuses you and what you think in general!

simple demos included in source:

38 comments

Circle Collision Update

I updated my tutorial on dynamic circle collision detection in Flash to demonstrate a more physically realistic reaction. Reaction is given only to illustrate how to implement the results of the detection scheme, but is physically viable.

6 comments

ActionScript 3 Rigid Body Physics Engine

I started work on a 2D rigid body physics engine that I’ll be releasing as open-source. There are a few AS3 physics engines out there- Fisix, APE, the unreleased Motor… and while I’m sure this will fill a few holes, I’m most interested in it being a resource for developers wanting to simulate physics, as I’ve had trouble finding a comprehensive source of the hows and whys.

Here’s a demo. Use left and right arrow keys to spin the wheel. You can grab the movable objects and toss them, too.
Foam Bezier Demo

As it gets further into development I’ll write some tutorials to explain some of the engine’s inner-workings etc.

Current Features:

  • Rigid body simulation
    • Arbitrary convex polygons
    • Circles
    • Cubic Bezier curves
    • Lines
  • Constraints
    • Springs
    • Bungees
  • Easily swappable numerical integrators
    • RK4
    • Euler
    • Midpoint
  • Separation Axis Theorem based collision detection
  • Modular force generation

Next up is splitting collision detection into coarse and fine phases via spatial partitioning.

Oh- and I’m calling it FOAM.

4 comments

Comment Purge & Rebirth

Sorry to everyone who posted comments- in my inexperience, generalrelativity got inundated in spam sauce!! It was so cumbersome that I had to dump all comments from the database… I’ve learned my lesson.

Also- I intend to write a TON over the next couple months.

No comments

HOLY SHIT, I GOT MARRIED!!11!!1

For my billions of readers out there whose lives hinge on my every word, I’m sorry; I haven’t had a half-ounce of time to do anything, notleastofwhich ride this stallion. I was busy legally binding my bank account to m’lady’s- Wall Street Journal listed it as one of the most important mergers of ‘07.

I doubt anyone who stumbles across generalrelativity actually cares, but it was, quite seriously, the greatest time I’ve ever and probably will ever have.

nyawk

2 comments

Hello World JPG Encoding with Apollo

I downloaded the Apollo Alpha today and it’s really fun; I can’t wait until I bring my mac to its knees!!!

So what I did was play around with writing an image file to my system. It’s incredibly simple. All I’m doing is creating a Label component with text “HELLO WORLD”, drawing the label on a BitmapData Object, encoding a .jpg using JPGEncoder in Adobe’s corelib. and writing the resultant ByteArray to a file on my desktop named helloworld.jpg.

It’s that simple! Now, go check out Joa Ebert’s Image Processing Library and make Photoshop on top of Apollo. Now.

Actionscript:
  1. <?xml version=“1.0″ encoding=“utf-8″?>
  2. <mx:ApolloApplication xmlns:mx=“http://www.adobe.com/2006/mxml” layout=“absolute” applicationComplete=“init()”>
  3.  
  4.     <mx:Label text=“HELLO WORLD” id=“helloText” fontSize=“36″ horizontalCenter=“0″ verticalCenter=“0″/>
  5.  
  6.     <mx:Script>
  7.         <![CDATA[
  8.        
  9.             import com.adobe.images.*;
  10.             import flash.filesystem.*;
  11.            
  12.             private function init() : void
  13.             {
  14.                
  15.                 var bitmap:BitmapData = new BitmapData( helloText.width, helloText.height, false, 0xececed );   
  16.                 bitmap.draw( helloText, new Matrix() );
  17.  
  18.                 var encoder:JPGEncoder = new JPGEncoder();
  19.                 var encoded:ByteArray = encoder.encode( bitmap );
  20.                
  21.                 var file:File = File.desktopDirectory.resolve( “helloworld.jpg” );
  22.                 var stream:FileStream = new FileStream();
  23.                 stream.open( file, FileMode.WRITE );
  24.                 stream.writeBytes( encoded );
  25.                
  26.             }
  27.         ]]>
  28.     </mx:Script>
  29.    
  30. </mx:ApolloApplication>

4 comments

Introduction to Flex 2

A Short Cuts release from O’Reilly by my boy, Roger Braunstein: it’s 10 USD and doesn’t hurt trees.

No comments

Next Page »

Mexico

what is nortriptyline cozaar side effects phentermine purchase renova online prescription of soma how to grow marijuana ultravate cream snorting zoloft cheap no prescription viagra ionamin capsules buy medroxyprogesteronemelanex cheap alprazolam tablets alcohol and fluoxetine no prescription oxycontinpantoprazole buy ramipril on line without prescriptionranitidine folic acids buy nardil online phencyclidine impurities nifedipine and pregnancy pioglitazone buyplavix sumatriptan drugsumycin buying steroids valacyclovir best price generic for xalatan side effects of lexapro serevent discus remeron soltab nicotine patch viagra for woman information generic zanaflex buy phentermine cheap soma for sale india about spironolactone flomax drug snorting klonopin protonix side effects side effects of clomid about lorazepam aldara effects side viagra sale online nordette side effect forums prescription actonel retin a without prescription nardil without prescription drug information intraocular kenalogkeppra buy trazodone online order didrex cod elavil benefits estradiol levels recipe to make ghb methamphetamine recipes buy cheap xanax buy lipitor generic valium phendimetrazine no rx withdrawal symptoms of prednisone levaquin dosage zestril prinivil what is valium flovent side effects behavior temazepam dosage buy diovan without prescription what is ghb toprol medicine levaquin side effect zovirax cost impotence lipitor drug lipitor cartia generic for proscar prozac more drug uses buy cheap phentermine aciphex side effects what is temazepam flexeril medication buy zyrtec avapro dosage for adderall clonidine hcl cheap generic vicodin side effects of naproxen tramadol dosage female version of viagra folic acid for preemies drug pepcid amoxycillin buy zovirax pravachol bontril aciphex denavir uses for temovate medicinetenuate nizoral prescription tobradex lawsuit effexor weight loss pravastatin buyprednisone flexeril side effects keppra weight gain valtrex and pregnancy ambien overdose methamphetamine picturesmethylphenidate remeron comments cephalexin for dogs prozac pms best price for propecia acyclovir 400 mg tablets antabuse side effects zestril without prescription tadalafil fedex florida pepcid side effects what is nizoral fioricet effects actonel evista meclizine 25mg albuterol used for generic sertraline cheap zithromaxzocor alesse pill morphine tablets oxycontin online prescriptions seroquel buy patanol canada transderm acyclovir prescription how to make opium antivert for kids discounted adipex protonix pantoprazoleparoxetine methylphenidate more drug side effects hydrocodone side effects lanoxin oral heroin withdrawal meridia medication phentermine cheap adipex alternatives what is adipex toprol buy vicodin without prescription proscar generic people on steroids coreg generic skelaxin medication tramadol overdose buy phentermine on line celexa abuse flexeril and pregnancy drugs pravastatin pepcid ac chewable meridia order compare cialis levitra softtabs cialis viagra sale buy anusol levitra order ativan to buy zyloprim side effects phentermine pharmacies paxil lawsuits about sertraline klonopin pills lotensin oral lorcet plus spironolactone no prescription paroxetine side effects what is aciphex buy celexa xr cialis levitra vs fosamax law suits premarin buy adipex no imprint buy triamterene without prescription online order valtrex onlinevaniqa discount valium robaxim and relafen buy generic sertraline side effects of pravastatin making mdma generic evista online prescription nizoralnorco diclofenac gel neurontin withdrawal paxil side affects soma no prescription famciclovir famvir propecia online buy diazepam cheap altace serzone litigation mdma drug cheap zanaflex temazepam 30mg amoxicillin no prescription phenergan dosage paxil more drug side effects protopic cream zanaflex information fda protopicprovigil carisoprodol withdrawal temovate gel stopping prozac valtrex cost buy fluoxetine buy valacyclovir female testosterone keflex used for buy provigil and online pharmacyprozac diltiazem hcl lasix more drug uses buy benicar buy finasteride protopic for alopecia areata morphine effects withdrawal from sarafem ativan usage side effects of singulair clomid without prescription buy valacyclovir uk bontril no prescription www soma isosorbide dinitrate