Hugs for the lonely
Posted by Fredrik | Filed under Actionscript, Adobe Flash, Design, Lonely Duck, Portfolio, Work

Lonely duck are joining forces with the Red Cross to support the lonely this christmas. Make a difference at www.redcross.se/kram
Creativity by Fredrik Johansson. Interactive Director at Lonely Duck
Posted by Fredrik | Filed under Actionscript, Adobe Flash, Design, Lonely Duck, Portfolio, Work

Lonely duck are joining forces with the Red Cross to support the lonely this christmas. Make a difference at www.redcross.se/kram
Permalink | December 2nd, 2008
Lonely Duck HQ
Lonely Duck HQ
Westin/Johansson CasaSo 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
This is the blog of Fredrik Johansson, or Signar when appearing on the web.
This Blog is mainly intended to document my work and I will try to share code
learnings and thoughs as often as I can.
© Copyright 2010 SIGNAR | Blog
Design by: styleshout | Colourise by: Theme Lab and Best Linux Web Hosting