Some favorite site feeds aggregated locally: iPhone Development RSS   Adobe Labs RSS   Macrumors RSS

Tuesday, August 18, 2009

AS3 Developers and the iPhone

Tuesday, August 18, 2009    0 Comments

Silently I have been watching a revolution of another kind take shape in the Flash Developer Community. A revolution that I at first found to be surprising, but now find exciting and interesting.

For a long while, the most exciting content on the web has been developed within the fold of the Flash Community. The Flash Community is an organic, open network of creative and devoted people constantly pushing the boundaries of cool, interactive, data-driven, and experimental. I am not going to get into a debate of AJAX versus Flash versus Silverlight, or anything like that... because I simply don't think you can bring Flash down to compare it to the others.

Of the hordes of Flash Developers, many have dipped their toes into the world of Xcode, Objective-C, and the iPhone SDK. I am seeing iPhone sessions popping up in many Flash conferences. I am seeing hardcore Flash developers (many for ages) twittering about various Obj-C methods, blogging about iPhone development, etc.

This is exciting because the iPhone itself is a platform that brings me a lot of satisfaction developing for. It's not Flash in terms of it's immediacy (at least not for me yet), but the things you can do with it after putting in some effort (googling, reading books, pouring over some code, reading header files, etc.) is astounding.

When I am developing for the iPhone, I feel like the sky is the limit and I am constantly trying to do things that were easy for me to do in Flash. Because of that Flash experience, I am able to deliver some compelling applications. And so are many other Flash developers.

The iPhone has a lot going for it in terms of apps. Yes, many throw their first few attempts on the store just to see what that feels like... but in the end we are going to be treated to a lot of wonderful content as more and more Flash developers and designers start learning Obj-C and making apps of their own.

AS3 is certainly fun. But the iPhone distraction is fun too; it's mysterious, enabling and almost as open as the Flash Community. You're still more likely to pull code out of readers on a Flash mailing list than you are on a Cocoa mailing list, but I see that softening a bit.

Anyway, this is just something I've noticed and something that I really like seeing.

Labels: ,

 

Sunday, July 19, 2009

I don't know about you, but...

Sunday, July 19, 2009    5 Comments

I don't know about you, but I am ready for some AS3.1. Whatever that could be.

Labels:

 

Wednesday, July 15, 2009

Text Layout Framework

Wednesday, July 15, 2009    2 Comments

Adobe Labs has been producing weekly builds of their Text Layout Framework (making them available on Fridays), allowing for sophisticated and innovative typography within Flash.

I can remember years and years of developers and designer bitching about the lack of support for RTL, etc. and I am wondering if any are actually involved in flushing some of this functionality into their projects or work?

There is even a component available to work within Flash CS4 to aid in the setup of Text Layout Framework utilization.

If you forgot about this stuff, head on over.

Labels: , ,

 

Monday, July 13, 2009

AS3: TrueTimer from Gritfish

Monday, July 13, 2009    1 Comments

Gritfish's TrueTimer class is something that attempts to tackle the inaccuracy of the built-in Timer class. Run over and read his post and see the class, or you can check it out here as well. I have not yet implemented this in anything, it seems that when you receive a Timer event, you're going to have to read the classes public variables instead of getting them from the Timer event object itself. Which is fine I guess.



A quick use example (make sure your listener method is using type of Event and not TimerEvent though - I ran into that myself for a minute).
var myTimer:TrueTimer = new TrueTimer( 100, 100 );
myTimer.addEventListener( TimerEvent.TIMER, onMyTimer );

function onMyTimer( e:Event ):void {
//you can't use the e.currentTarget.currentCount or anything like that
trace( myTimer.currentCount );
}
And here is the base class itself:
package {
import flash.display.*
import flash.events.*
import flash.utils.*
public class TrueTimer extends MovieClip {
public var delay:int
public var repeatCount:int
public var initTime:Date
public var currentTime:Date
public var currentCount = 0
public var __offset:int = 0
public var running:Boolean = false
public var timeFromStart = 0
public var timeShouldBe = 0

public function TrueTimer(DELAY,REPEAT){
delay = DELAY
repeatCount = REPEAT

initTime = new Date()
currentTime = initTime
}
public function evaluateTime(e:Event){
var now = new Date()
var msDiff = now.valueOf() - currentTime.valueOf()
__offset += msDiff
currentTime = now
if(__offset > delay){
while(__offset > delay){
currentCount ++
__offset -= delay

if(repeatCount != 0){
if(currentCount == repeatCount){
timeFromStart = now.valueOf() - initTime.valueOf()
timeShouldBe = (repeatCount*delay)
dispatchEvent(new Event(TimerEvent.TIMER))
dispatchEvent(new Event(TimerEvent.TIMER_COMPLETE))
__stop()
}else if(currentCount < repeatCount){
timeFromStart = now.valueOf() - initTime.valueOf()
timeShouldBe = (repeatCount*delay)
dispatchEvent(new Event(TimerEvent.TIMER))
}
}else{
timeFromStart = now.valueOf() - initTime.valueOf()
timeShouldBe = (repeatCount*delay)
dispatchEvent(new Event(TimerEvent.TIMER))
}
}
}
}
public function __start(){
initTime = new Date()
currentTime = initTime
running = true
addEventListener(Event.ENTER_FRAME,evaluateTime)
}
public function __stop(){
running = false
removeEventListener(Event.ENTER_FRAME,evaluateTime)
}
public function __clear(){
currentCount = 0
__offset = 0
running = false
removeEventListener(Event.ENTER_FRAME,evaluateTime)
}
}
}

Labels: ,

 

Sunday, July 12, 2009

FlashDevelop 3.0.2 RTM Released

Sunday, July 12, 2009    0 Comments

FlashDevelop 3.0.2 RTM released
This release fixes issues found after 3.0.1. We added few options and fixed some issues in the completion and the UI. Enjoy!

About FlashDevelop:

* Features
* Screenshots

Note to customizers:

This release is fully compatible with RC2 - 3.0.1 RTM.

List of changes:

* Find and replace regex engine fixed
* TraceManager now resist message flooding
* Start Menu group creation is now optional
* Script errors are now ignored by the browser control
* Completion now shows local "Class" vars after new keyword
* Option added to generarate code always with access modifiers
* Option added to disable haXe compiler based completion
* Option added to disable the find text updating on F3
* Other small completion and UI bug fixes

Future plans:

* Finish the one of the debuggers, investigate profiling.
* Implement class imports reorganisation and packages refactoring.
* Add HTML/JS projects, investigate Jangaroo AS to JS compilation.
* Evaluate the possible cross-platform implementation.
* Make the MXML completion actually smart.

Important:

* Get the debug Flash Player (You need: Projector and ActiveX)
* Get Adobe Flex 3 SDK. The free Flex SDK (2 or 3) is required for ActionScript 3 development if you don't use Flash CS3.
* Java 1.6+ is required for the Flex compiler (ActionScript 3).

:!: If you think the program is good, please donate some money for this project. :!:

Download:

Built from rev. 612
Download FlashDevelop 3.0.2 RTM

Labels: , ,

 

Wednesday, July 8, 2009

AS3 range slider with multiple thumbs?

Wednesday, July 8, 2009    11 Comments

Update 2:
Here is a quick example of the working component as it stands right now. Implements setting thumb positions and all that jazz.



Update:
I started coding up an AS3 quasi-component and it's working pretty well. It's kind of hard-coded for my immediate needs, but I may just release it so you can implement custom events for it and roll it as a proper component.

It doesn't look like the sample below, the thumbs carry along their current value based on the max value set for the whole slider, use color-coded sections to better help visualize, etc.

If I get some spare time, I'll probably roll it into a proper component since it's not too hard but rather time-consuming. As most things I suppose.

If you are at all interested in using a range (partition) slider outside of Flex (that doesn't require Flex at all), then you may want to pay a little extra attention to this blog in the near future.

I've seen sliders, I've seen Flex sliders with two thumbs, but I have yet to see a slider that has more than two thumbs. I've been searching all over the place and I just haven't found one yet. I was hoping to locate one to save me the time and energy of coding one up myself from scratch. It's not terribly difficult, just really time consuming.

If you've seen one of these around, please let me know. I am hoping to save development time for my actual application and not having to cut out some of that time to create a multi-range slider.

Yes, I know the use case for a slider that can support 2+ thumbs is rare. Any help would be appreciated.

Here is an image of a component I already started:
slider
How I imagine it. The slider has a base min and max. Defaults to 1 thumb maybe. You can add thumbs and when you do you specify a value for it's initial placement.

To make it easy, any time any of the thumbs are moved, values for all are set for the change event, in the order of the thumbs, say an array of values. You can't drag a thumb over another thumb.

Labels: , ,

 

Friday, February 13, 2009

Namespaces are a pain

Friday, February 13, 2009    1 Comments

var myLoader:URLLoader = new URLLoader();
myLoader.addEventListener( Event.COMPLETE, onLoadXML );
myLoader.load( new URLRequest( "http://www.xignite.com/xquotes.asmx/GetQuote?Symbol=AAPL" ));
function onLoadXML( e:Event ):void
{
var ns:Namespace = new Namespace("http://www.xignite.com/services/");
var myXML:XML = new XML( e.target.data );

trace( "Name " + myXML.ns::Name );
trace( "Last " + myXML.ns::Quote.ns::Last );
trace( "Price Earnings " + myXML.ns::Statistics.ns::Price_Earnings );
trace( myXML.ns::News.ns::StockNews.ns::Headline[0] );
var len:Number = myXML.ns::News.ns::StockNews.ns::Headline.length();
trace( myXML.ns::News.ns::StockNews.ns::Headline[len-1]);
}
I mean, come on, that's just weird. Why couldn't I set the namespace once somehow and just use regular dot notation from then on out? (Unless I can and I am missing something). I pulled the code above out of my backside and lo' and behold it worked.

Namespaces are something I need to properly wrap my head around, as it seems it's coming up more and more. I wasn't even quite sure that my original parsing problem was namespace related or not. In the above XML returned, do they really need to define namespaces?

Here is something better (this is all still a bit of a pain):
var myLoader:URLLoader = new URLLoader();
myLoader.addEventListener( Event.COMPLETE, onLoadXML );
myLoader.load( new URLRequest("http://www.xignite.com/xquotes.asmx/GetQuote?Symbol=AAPL" ));
myLoader.dataFormat = "XML";

function onLoadXML( e:Event ):void {
var myXML:XML = new XML(e.target.data);
if( myXML.namespace() != null)
default xml namespace = myXML.namespace();
trace("Outcome: ", myXML.Outcome);
trace("Delay: ", myXML.Delay);
}

Labels: , ,

 

Monday, February 9, 2009

Navigating Yahoo! weather nodes

Monday, February 9, 2009    1 Comments

I took a straight XML approach to loading weather data from Yahoo! by simply using a URLLoader and using the address http://weather.yahooapis.com/forecastrss?p=01701. It returns an XML blob full of current and forecast data, which is great & it's very fast. Previously I was using a different service and it worked well for the 10% of the uptime the service provided (ugh). So a service on stronger footing was required, hence Yahoo!

Accessing the nodes by hand isn't exactly straight-forward though. One of the nodes I am most interested in looks like this in the resulting XML: <yweather:condition text="Mostly Cloudy" code="26" temp="57" ></yweather:condition> - perfectly understandable. But if you try to access it like so:
private function loadedXML(e:Event):void
{
var myXML:XML = new XML(e.target.data);
trace(myXML.channel.item.yweather:condition);
}
you'll get a compiler barf about that ":" in the node name. So you CAN access it like so:
private function loadedXML(e:Event):void
{
var myXML:XML = new XML(e.target.data);
trace(myXML.channel.item.children()[5]);
}
However that leaves an incredibly bad taste in my mouth as if the order of the tags ever change, this code breaks. I did throw a question to the FlashCoders list about this too. There has got to be a superior solution to this. I did quickly try to use the Yahoo! webapis classes to get this job done, but I was getting strange WeatherResultEvent errors and decided to quickly roll my own up.

UPDATE:

Thanks to FC, I looked to Namespaces. It took a bit to get it going, but here we are:
private function loadedXML(e:Event):void
{
var myXML:XML = new XML(e.target.data);
var foo:Namespace = new Namespace("http://xml.weather.yahoo.com/ns/rss/1.0");
trace( myXML.foo::condition.@text );
}
A major part of the problem was the online specifications from Yahoo! were wrong, and the namespace URI was incorrect. That didn't help much. Once I dug into the returned XML myself, I saw the problem right away.

UPDATE 2:

Here is something I wasn't aware that I could do. Now, there are several yweather:forecast nodes, one node per day reported. Well, you could grab the node attribute, which runs all the node values for each into one big, useless string that you can't substring because you don't know the length of each individual one, or you can do this:
var txt:String = myXML.channel.item.foo::forecast.@text[0];
var txt2:String = myXML.channel.item.foo::forecast.@text[1];
Works like a charm and you don't need to approach any hacks getting that data out of there. I tried it on a whim & it worked, albeit I am not completely up to snuff with XML as I was with AS2. AS3 is SO much better as I find out nearly daily. I don't think they need AS4 ever... just add some things to 3.

Labels: , ,

 

Wednesday, May 7, 2008

AS3: Clearing out loader instance contents

Wednesday, May 7, 2008    3 Comments

This wasn't very obvious to me at first, so I report my working findings here for the benefit of perhaps someone out there. 

I have a gallery application that uses two instances of a Loader. Instead of creating/destroying the instances, I re-use the instances... but for me to make swapping galleries (full swap), I needed a way to clear out the images in the Loader instances... essentially creating a reset method in my gallery class. 

Well... there isn't an obvious clear() anywhere, and when you inspect the contents of a Loader instance (that has been loaded successfully), you'll notice it's BitmapData. Okay... so we need a way of throwing out that type of data. We have the dispose() method.

However, depending on where one might be in the cycling of images (fading), you might have a Loader that doesn't presently contain BitmapData. This might be when you're only one image into the whole cycle of images... trying to clear out both at once in the reset would throw an error.

The code below reflects usage that works for me right now. 


var li = child2.loader.contentLoaderInfo;
if( child2.loader.content != null )
{
    if(li.childAllowsParent && li.content is Bitmap)
    {
        (li.content as Bitmap).bitmapData.dispose();
    }
}

var li2 = child1.loader.contentLoaderInfo;
if( child1.loader.content != null )
{
    if(li2.childAllowsParent && li2.content is Bitmap)
    {
        (li2.content as Bitmap).bitmapData.dispose(); 
    }
}



So this checks the contents of each of the loaders and then clears the contents out... then I am free to load up the new XML and start my timer, etc. It works... before I was getting mucked up cycling after a gallery switch.

Labels: ,

 

Tuesday, March 4, 2008

AS3/AIR Poster

Tuesday, March 4, 2008    3 Comments


I finally managed to get a 20" x 48" roll print of the ActionScript 3.0 Class Diagram [reference] to print (updated with AIR APIs), and even at this size, its probably close to 50% of how large it actually needs to be printed. Combine this with the Flex posters (new and the old powder blue ones) and I could probably fully wallpaper a decently-sized bathroom.

I taped the AS3 one up on my locker so the department has full access to it. Very nice. That must be one huge ass Illustrator file someplace in bowels of Adobe. A lot of work went into these, thanks Adobe!

Labels: ,

 

Friday, July 6, 2007

Test Code Posting

Friday, July 6, 2007    0 Comments

I am testing the display of some code, since I am migrating CSS and other things, I'd like to try to ensure a sweet transition when the DNS changes take place. This is just a piece of larger code stuff.

package
{
import flash.display.DisplayObject;
import flash.events.Event;
import flash.display.Sprite;
import flash.geom.ColorTransform;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;

// XML-Specific
import flash.events.ErrorEvent;
import flash.xml.XMLDocument;
import flash.net.URLLoader;
import flash.net.URLRequest;

/**
* AS3.0 Class to provide user selection of various
* Flash-specific resource documentation/files.
*
* Author: Eric E. Dolecki
* Copyright: 2007, Eric E. Dolecki
*/
public class Resources extends Sprite
{
private var BaseColor:Number = 0x414042;
private var RollOverColor:Number = 0xCCC2C0;
private var SelectedColor:Number = 0xF15B40;
private var navArray;
private var nCurrentSelection:Number = 0;
public var sectionId = "";

// XML-Specific
private var urlLoader:URLLoader;
public static var data:XML;

public function Resources()
{
navArray = new Array();
xmlLoader();
};
}
}

Labels: ,