Twitter dev gems of September 2010
Goodies about Flash and iPhone development found through twitter during the last month.
Goodies about Flash and iPhone development found through twitter during the last month.
So about that little crossdomain image loading hack.
on the INIT event of your loader do the following:
var lInfo:LoaderInfo = e.target as LoaderInfo;
var dO:DisplayObject;
try{
dO = lInfo.content as DisplayObject;
} catch(err:SecurityError){
var spt:Sprite = new Sprite();
spt.addChild(lInfo.loader);
dO = spt;
}
Courtesy of @michaelSvendsen
Had some problem with long http links in a UIWebView so I created this simple function that finds links existing in a NSString and creates an a-tag with a “Read more” label. Suited my needs for the moment.
- (NSString *)parseLinks:(NSString *)html { NSScanner *theScanner; NSString *text = nil; theScanner = [NSScanner scannerWithString:html]; while ([theScanner isAtEnd] == NO) { // find start of tag [theScanner scanUpToString:@"http" intoString:NULL] ; // find end of tags [theScanner scanUpToString:@"<" intoString:&text] ; html = [html stringByReplacingOccurrencesOfString: [NSString stringWithFormat:@"%@", text] withString:[NSString stringWithFormat:@"Read more", text]]; break; } return html; }
Want to store light information such as user defaults, current highscore fast and easy? Just use NSUserDefault.
Example: Adding the current highscore:
[[NSUserDefaults standardUserDefaults] setInteger:scoreValue forKey:@"score"];
Example: Get the current highscore
[[NSUserDefaults standardUserDefaults] integerForKey:@"score"]];
Except primitives it works for NSData, NSString, NSNumber, NSDate, NSArray and NSDictionary
Trying out tumblr. Thinking this going to some sort of a iphone dev diary for me. Peace