The component itself is a transparent canvas (background alpha = 0), which means that you can put it on top of anything you like in order to be able to draw anywhere.
On the mouse down event I add a mouse move listener which adds points to an array, and I remove the listener on the mouse up event. These arrays are the lines.
In the updateDisplayList method I loop through all the held arrays and draw them onto the canvas.
source
Adobe Flex is a software development kit released by Adobe Systems for the development and deployment of cross-platform rich Internet applications based on the Adobe Flash platform. Flex applications can be written using Adobe Flex Builder or by using the freely available Flex compiler from Adobe.
Wednesday, June 29, 2011
Flex FlowBox Container
Awesome container i've been looking for!!!
A container which would lay its child components out in a horizontal manner like an HBox, but unlike an HBox, it needed to wrap the child components into a new row when they exceeded the available width. If the available height was exceeded, the container should then grow downwards if the height property has not been set to a constrained value. If the height is constrained, then scrollbars should appear
check out
source
A container which would lay its child components out in a horizontal manner like an HBox, but unlike an HBox, it needed to wrap the child components into a new row when they exceeded the available width. If the available height was exceeded, the container should then grow downwards if the height property has not been set to a constrained value. If the height is constrained, then scrollbars should appear
check out
source
Friday, June 24, 2011
Flex Share on twitter
//Twitter/Bit.Ly Share Imports
import flash.net.navigateToURL;
import mx.rpc.events.ResultEvent;
import mx.rpc.xml.SimpleXMLDecoder;
import mx.utils.ObjectUtil;
//Twitter/Bit.Ly Share Vars
private var bitLyLoader:URLLoader;
/*
* Call this function to share on twitter, passing your url trough bit.ly!
*/
private function twitterShare(articleUrl:String):void
{
// Insert your bit.ly account name & API Key bellow
var bitLyApiUrl:String = "http://api.bit.ly/v3/shorten?login=ACCOUNT NAME&apiKey=API KEY&longUrl="+articleUrl+"&format=xml";
var bitLyApi:URLRequest = new URLRequest(bitLyApiUrl);
bitLyLoader = new URLLoader(bitLyApi);
bitLyLoader.addEventListener(Event.COMPLETE, bitLyFinished);
}
/*
* Get the short link & post to twitter
*/
private function bitLyFinished(event:Event):void
{
// Lets decode the bit.ly answer!
var getLink:XMLDocument = new XMLDocument(bitLyLoader.data);
var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true);
var bitLyLink:Object = decoder.decodeXML(getLink);
// Insert your message bellow! Use %23 for trending topics! (Example: %23DigitalWorks)
var URL:String = "http://twitter.com/home?status=Currently reading "+bitLyLink+" %23DigitalWorks";
navigateToURL(new URLRequest(URL), '_blank');
}
import flash.net.navigateToURL;
import mx.rpc.events.ResultEvent;
import mx.rpc.xml.SimpleXMLDecoder;
import mx.utils.ObjectUtil;
//Twitter/Bit.Ly Share Vars
private var bitLyLoader:URLLoader;
/*
* Call this function to share on twitter, passing your url trough bit.ly!
*/
private function twitterShare(articleUrl:String):void
{
// Insert your bit.ly account name & API Key bellow
var bitLyApiUrl:String = "http://api.bit.ly/v3/shorten?login=ACCOUNT NAME&apiKey=API KEY&longUrl="+articleUrl+"&format=xml";
var bitLyApi:URLRequest = new URLRequest(bitLyApiUrl);
bitLyLoader = new URLLoader(bitLyApi);
bitLyLoader.addEventListener(Event.COMPLETE, bitLyFinished);
}
/*
* Get the short link & post to twitter
*/
private function bitLyFinished(event:Event):void
{
// Lets decode the bit.ly answer!
var getLink:XMLDocument = new XMLDocument(bitLyLoader.data);
var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true);
var bitLyLink:Object = decoder.decodeXML(getLink);
// Insert your message bellow! Use %23 for trending topics! (Example: %23DigitalWorks)
var URL:String = "http://twitter.com/home?status=Currently reading "+bitLyLink+" %23DigitalWorks";
navigateToURL(new URLRequest(URL), '_blank');
}
Flex Share on facebook
/**
* Flex Share on facebook - quick & easy way
**/
public function ShareOnFacebook(shareUrl:String):void
{
var openUrl:String = "http://www.facebook.com/sharer.php?u="+shareUrl;
navigateToURL(new URLRequest(openUrl), '_blank');
}
* Flex Share on facebook - quick & easy way
**/
public function ShareOnFacebook(shareUrl:String):void
{
var openUrl:String = "http://www.facebook.com/sharer.php?u="+shareUrl;
navigateToURL(new URLRequest(openUrl), '_blank');
}
Monday, June 6, 2011
scaleContent property is true, but the UILoader is not resized ?
Resizes the component to the requested size. If the scaleContent property is set to true, the UILoader is not resized.
import fl.containers.UILoader;
var myUILoader:UILoader = new UILoader();
myUILoader.source = "http://www.helpexamples.com/flash/images/image2.jpg";
myUILoader.addEventListener(Event.COMPLETE, completeHandler);
addChild(myUILoader);
function completeHandler(event:Event):void {
var uiLdr:UILoader = event.currentTarget as UILoader;
var image:DisplayObject = uiLdr.content as DisplayObject;
trace("UILoader:", uiLdr.width, uiLdr.height); // 100 100
trace("UILoader.content:", image.width, image.height); // 400 267
uiLdr.setSize(image.width, image.height);
uiLdr.move((stage.stageWidth - image.width) / 2, (stage.stageHeight - image.height) / 2);
}
import fl.containers.UILoader;
var myUILoader:UILoader = new UILoader();
myUILoader.source = "http://www.helpexamples.com/flash/images/image2.jpg";
myUILoader.addEventListener(Event.COMPLETE, completeHandler);
addChild(myUILoader);
function completeHandler(event:Event):void {
var uiLdr:UILoader = event.currentTarget as UILoader;
var image:DisplayObject = uiLdr.content as DisplayObject;
trace("UILoader:", uiLdr.width, uiLdr.height); // 100 100
trace("UILoader.content:", image.width, image.height); // 400 267
uiLdr.setSize(image.width, image.height);
uiLdr.move((stage.stageWidth - image.width) / 2, (stage.stageHeight - image.height) / 2);
}
Subscribe to:
Posts (Atom)
Freelance
Find more freelance jobs