<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">

	<channel>
		<title><![CDATA[ActionScript.org Flash, Flex and ActionScript Resources - Blogs]]></title>
		<link>http://www.actionscript.org/resources</link>
		<description><![CDATA[ActionScript.org is the premier ActionScript developer community online for Flash and Flex users. One of the largest such sites in the world, ActionScript.org caters for designers and developers at all skill levels. The site includes thousands of tutorials, open source movies and scripts, support forums, reviews, scene news, a fully featured Flash jobs and employment section and much more.]]></description>
		<language>en-us</language>
		<copyright><![CDATA[http://www.actionscript.org/resources]]></copyright>
		<generator>N/A</generator>
		<webMaster>general.redirect@gmail.com</webMaster>
		<lastBuildDate>Thu, 23 May 2013 15:50:18 CDT</lastBuildDate>
		<ttl>20</ttl>
		<item>
			<title><![CDATA[Facebook and Twitter buttons in Flash and Flex]]></title>
			<link>http://www.actionscript.org/resources/blogs/52/Facebook-and-Twitter-buttons-in-Flash-and-Flex.html</link>
			<description><![CDATA[Here's Actionscript code for a "Tweet This" button for Twitter, or "Like" or "Recommend" button for Facebook. When the button is clicked, call the socialUpdate() function below, passing in the text and link that you wish to post. For example:<br/><br/>socialUpdate("twitter", "Views from space", "http://www.esa.int/esaHS/SEMG2856JGG_index_mg_1.html");<br/><br/><img title="" alt="" src="http://www.actionscript.org/resources/content_images/1505/share.png" align="Baseline" border="0" height="92" width="390"/><br/><br/>Both the text and the link can be blank. Here's the code to include:<br/><br/>function socialUpdate(site:String, text:String = "", link:String = "")<br/>{<br/>    // initialize<br/>    var siteURL:String;<br/>    var maxLength:Number;<br/>    switch (site)<br/>    {<br/>        case "facebook":<br/>            maxLength = 255;<br/>        break;<br/>        case "twitter":<br/>            maxLength = 140;<br/>        break;<br/>        default:<br/>            return;<br/>        break;<br/>    }<br/>    <br/>    // truncate passed text if necessary<br/>    var availableTextLength:Number = maxLength - (link.length + 1);<br/>    if (text.length > availableTextLength)<br/>    {<br/>        text = text.substr(0, (availableTextLength - 3)) + '...';<br/>    }<br/>    <br/>    // construct url to site<br/>    switch (site)<br/>    {<br/>        case "facebook":<br/>            siteURL = "http://www.facebook.com/share.php?u=" + encodeURIComponent(link) + "&t=" + encodeURIComponent(text);<br/>        break;<br/>        case "twitter":<br/>            siteURL = "http://twitter.com/share?text=" + encodeURIComponent(text) + "&url=" + encodeURIComponent(link);<br/>        break;<br/>    }<br/>    <br/>    // open new popup window to site<br/>    var urlRequest:URLRequest = new URLRequest(siteURL);<br/>    navigateToURL(urlRequest, "_blank");<br/>}<br/><br/>Truncating the tweet text and ending it with an ellipsis was something I saw on <a  href="http://www.saschakimmel.com/2009/05/how-to-create-a-dynamic-tweet-this-button-with-javascript/">Sascha Kimmel</a>'s blog.<br/><br/>When creating a Facebook post for a web page, you can specify the page's title, description and thumbnail that appear on the Facebook post. This is optional, as Facebook will try to find a good thumbnail image and text for the page if they are not provided by you. To provide them, add the following meta tags to the HEAD section of the web page:<br/><br/><meta property="og:title" content="Views from Space" /><br/><meta property="og:description" content="Photos of Earth from the International Space Station's Cupola" /><br/><meta property="og:image" content="http://www.esa.int/images/iss025e009840,0.jpg" /><br/><br/>The image for the thumbnail should be roughly square, with minimum dimensions of 50 x 50 pixels. It can be a PNG, JPEG, or GIF image.<br/>]]></description>
			<author>no@spam.com (Haik Sahakian)</author>
			<pubDate><![CDATA[Fri, 14 Jan 2011 00:00:00 CST]]></pubDate>
			<guid isPermaLink="true">http://www.actionscript.org/resources/blogs/52/Facebook-and-Twitter-buttons-in-Flash-and-Flex.html</guid>
		</item>
		<item>
			<title><![CDATA[Using a Color Gradient as the Text Color in Flex 3]]></title>
			<link>http://www.actionscript.org/resources/blogs/47/Using-a-Color-Gradient-as-the-Text-Color-in-Flex-3.html</link>
			<description><![CDATA[<p>Flex 3 or Flash doesn&#08217t natively support using a color gradient as the color for text. Instead, you need to create a gradient bitmap and use a bitmap of the text as a mask against the gradient. <br/>
    <br/>
Here&#08217s a quick function that does this, using the <a target="_blank"  href="http://userflex.wordpress.com/2008/01/30/add-canvas-gradient/">GradientCanvas</a> class from Nick Schneble&#08217s blog.  To use the function, pass in an ID of a Flex 3 text field, the X and Y coordinates at which the gradient text is to appear, and the name of a CSS class defining the gradient colors. </p>
<p>For example, if you had a text field that looked like:<br/></p><p><mx:Text text="Gradient Text" id="myTextField" x=&#0822110&#08221 y=&#0822110&#08221 /></p>
<p>Then the function call would look like:</p><p>drawGradientText(this, myTextField, 10, 10, "gradientStyle");</p>
<p>Your code would also need to include the <a target="_blank"  href="http://userflex.wordpress.com/2008/01/30/add-canvas-gradient/">GradientCanvas</a> class, and define a CSS class like this:</p><p>.gradientStyle    {fill-alphas: 1,1; fill-colors: #ff0000, #0000ff; corner-radius: 0}<br/>
</p>
<p><img title="" alt="" src="http://www.actionscript.org/resources/content_images/1505/gradient.png" width="345" align="Baseline" border="0" height="59"/><br/></p><p>The complete function is:</p><p>    public static function drawGradientText(container:UIComponent, sourceText:Text, sourceTextX:Number, sourceTextY:Number, gradientStyleName:String)<br/>
    {<br/>
       // check text height and width as zero values will lead to an invalid bitmap error<br/>
   if ( (sourceText.height < 1) || (sourceText.width < 1) ) return;</p>
<p>        // create a bitmap version of text to be used as a stencil<br/>
       var bitmapData:BitmapData = new BitmapData(sourceText.width, sourceText.height, true, 0);<br/>
       // use a matrix when writing into the bitmap to preserve transparency<br/>
       bitmapData.draw(sourceText, new Matrix());<br/>
       // convert the bitmap data into an image object to be able to add it to the flex stage as a UI Component<br/>
       var bitmap:Bitmap = new Bitmap(bitmapData, "auto", true);<br/>
       var image:Image = new Image();<br/>
       image.source = bitmap;<br/>
       image.cacheAsBitmap = true;<br/>
       // object and mask have to be directly over each other on the stage<br/>
       image.x = sourceTextX; <br/>
       image.y = sourceTextY;<br/>
       // add to the stage<br/>
       container.addChild(image);<br/>
    <br/>
       // create a gradient with the same size as the text bitmap<br/>
       var gradientCanvas:GradientCanvas = new GradientCanvas();<br/>
       gradientCanvas.width = sourceText.width;<br/>
       gradientCanvas.height = sourceText.height;<br/>
       // object and mask have to be directly over each other on the stage<br/>
       gradientCanvas.x = sourceTextX;<br/>
       gradientCanvas.y = sourceTextY;<br/>
       // set gradient colors<br/>
       gradientCanvas.styleName = gradientStyleName;<br/>
       // make the gradient's vector art available as a bitmap in Flash<br/>
       gradientCanvas.cacheAsBitmap = true;<br/>
       // mask the gradient with the text stencil<br/>
       gradientCanvas.mask = image;<br/>
       // add to the stage<br/>
       container.addChild(gradientCanvas);<br/>
    }<br/>
</p>

 ]]></description>
			<author>no@spam.com (Haik Sahakian)</author>
			<pubDate><![CDATA[Wed, 25 Aug 2010 00:00:00 CDT]]></pubDate>
			<guid isPermaLink="true">http://www.actionscript.org/resources/blogs/47/Using-a-Color-Gradient-as-the-Text-Color-in-Flex-3.html</guid>
		</item>
		<item>
			<title><![CDATA[Measuring and Reproducing a Low-Bandwidth Environment for Flash Video]]></title>
			<link>http://www.actionscript.org/resources/blogs/45/Measuring-and-Reproducing-a-Low-Bandwidth-Environment-for-Flash-Video.html</link>
			<description><![CDATA[<span style="font-weight: bold;"> Measuring bandwidth</span><br style="font-weight: bold;"><br/><a  href="http://www.youtube.com/my_speed">YouTube&#08217s speed testing site</a> gives a good estimate of how fast videos can play on a computer. Video streaming servers often have their bandwidth limited for a particular connection to 140% of the highest needed bandwidth for the video to play, so it&#08217s normal for a video to not fill up its buffer as fast as a network connection could allow.<br/><br/>YouTube&#08217s numbers for its customers show that typical bandwidth for the USA is 4.21 Mbps. This is more than enough for online video applications. As a comparison, today&#08217s high quality &#08220HD&#08221 web video is about 3 Mbps, regular DVD is 5 Mbps, and Blu-Ray DVD is <a  href="http://en.wikipedia.org/wiki/Bit_rate#Video">40 Mbps</a>. In 2005, typical web video was 0.3 Mbps (300kbps).<br/><br/><span style="font-weight: bold;">Reproducing a low-bandwidth environment</span><br style="font-weight: bold;"><br/>The easiest way to test on a low-bandwidth environment is to use a macintosh and ask the Mac OS firewall to limit the speed on a specific network port. This will limit the network speed on that port for the entire computer.<br/><br/>The ports that should be limited to simulate low-bandwidth web video performance issues are:<br/>Port 80: Non-encrypted HTTP traffic<br/>Port 443: Encrypted HTTPS traffic<br/>Port 1935: Streaming RTMP video<br/><br/>These are the only 3 ports required to limit. Note that this will reduce bandwidth for all applications using these ports, so you will notice the performance difference for all web pages, not just the ones you are testing.<br/><br/>O'Reilly's Mac Dev center has a good <a  href="http://tim.oreilly.com/pub/a/mac/2005/03/15/firewall.html">introduction to the Mac OS firewall</a>, and MacTipsAndTricks.com has a good <a  href="http://www.mactricksandtips.com/2008/12/throttling-bandwidth-on-a-mac.html">overview</a> of using it to reduce bandwidth. <br/><br/>As an example, to limit network activity to 50K a second (400Kbps, 0.4 Mbps), open a Terminal window in the Mac OS and enter the following:<br/><br/>sudo ipfw pipe 1 config bw 50KByte/s<br/>sudo ipfw add 1 pipe 1 src-port 80<br/>sudo ipfw pipe 2 config bw 50KByte/s<br/>sudo ipfw add 2 pipe 2 src-port 1935<br/>sudo ipfw pipe 3 config bw 50KByte/s<br/>sudo ipfw add 3 pipe 3 src-port 443<br/><br/>To remove the bandwidth limiting, enter the following:<br/>sudo ipfw delete 1<br/>sudo ipfw delete 2<br/>sudo ipfw delete 3<br/><br/>The bandwidth limits are set per port, so the browser's true bandwidth will be is higher because multiple ports may be used to render a page. HTML content is almost always loaded on port 80; streaming video is usually on port 1935. Once an HTML page has loaded and the video is playing, the bandwidth limit on streaming video will be accurate.<br/>]]></description>
			<author>no@spam.com (Haik Sahakian)</author>
			<pubDate><![CDATA[Sun, 09 May 2010 00:00:00 CDT]]></pubDate>
			<guid isPermaLink="true">http://www.actionscript.org/resources/blogs/45/Measuring-and-Reproducing-a-Low-Bandwidth-Environment-for-Flash-Video.html</guid>
		</item>
		<item>
			<title><![CDATA[Swfobject needs a <HEAD> tag in Safari]]></title>
			<link>http://www.actionscript.org/resources/blogs/44/Swfobject-needs-a-ltHEADgt-tag-in-Safari.html</link>
			<description><![CDATA[<a  href="http://code.google.com/p/swfobject/">Swfobject</a> creates 
child nodes inside the HEAD of a web page, so if a HEAD is not present it fails in 
Safari. You can place the swfobject.js in the body of your page as long 
as you have a head tag, even if it's an empty one.]]></description>
			<author>no@spam.com (Haik Sahakian)</author>
			<pubDate><![CDATA[Tue, 27 Apr 2010 00:00:00 CDT]]></pubDate>
			<guid isPermaLink="true">http://www.actionscript.org/resources/blogs/44/Swfobject-needs-a-ltHEADgt-tag-in-Safari.html</guid>
		</item>
		<item>
			<title><![CDATA[Two Minute Guide to the JavaScript Security Model]]></title>
			<link>http://www.actionscript.org/resources/blogs/43/Two-Minute-Guide-to-the-JavaScript-Security-Model.html</link>
			<description><![CDATA[The creators of the web allowed web pages to include content like images
 from any other server on the internet. But to protect web pages from 
being read by other web sites, they prevented web pages from talking to 
each other with JavaScript unless they were both from the same server.<br/><br/>As

 a result, pages can include images, CSS files, and JavaScript files 
from any server they wish. Framesets and IFRAMEs can also load web pages
 from anywhere. But JavaScript cannot communicate between two different 
servers.<br/><br/>This is a challenge for JavaScript programmers who would
 like to load data from another server. The most common solution takes 
advantage of the fact that JavaScript files are treated as regular 
network objects when being loaded (they can come from any server), but 
are bound by the stricter single origin policy when executing their 
script. Data can be passed to a different server as URL parameters on 
the SRC attribute of a SCRIPT tag, and is returned from that server when
 the JavaScript contents of the returned script file are executed.<br/><br/>Using

 this method to pass XML data from server to server is a little hard to 
work with because the XML has to be wrapped in JavaScript to be legal in
 a SCRIPT tag. It became easier for a server to output data in 
JavaScript itself rather than use XML. This JavaScript-based data format
 is called JSON, and is commonly used when sending data to a web page 
via a SCRIPT tag.<br/><br/>Sensitive data should not be transmitted in 
this way. Data being passed via a SCRIPT tag can indeed be read by a 
different web server, but it can now also be read by any web server.<br/><br/>In
 fact, if a regular HTML page mistakenly 
starts with JavaScript code instead of an HTML tag as it should, it 
becomes readable by a SCRIPT tag on a different server. Browsers will 
not allow non-script to be read in this way, but if your HTML page 
starts with JavaScript code, whether in a SCRIPT tag of its own or not, 
browsers will mistake the web page for an external script file and allow
 access. Validating HTML files protects against this.<br/><br/>Upcoming
 versions of HTML will allow web pages to establish trusted 
relationships with other web servers, but at present the most common way
 to share data between servers is to use a proxy server. A
 client-side Flash proxy can also be used, as Flash's crossdomain.xml 
allows data to be securely shared between different web servers.]]></description>
			<author>no@spam.com (Haik Sahakian)</author>
			<pubDate><![CDATA[Wed, 21 Apr 2010 00:00:00 CDT]]></pubDate>
			<guid isPermaLink="true">http://www.actionscript.org/resources/blogs/43/Two-Minute-Guide-to-the-JavaScript-Security-Model.html</guid>
		</item>
		<item>
			<title><![CDATA[Ant build in FDT hangs when using a relative path in front of the FLA filename]]></title>
			<link>http://www.actionscript.org/resources/blogs/42/Ant-build-in-FDT-hangs-when-using-a-relative-path-in-front-of-the-FLA-filename.html</link>
			<description><![CDATA[For the other person who ever has this problem, it looks like Ant builds
 in FDT that calls Flash to compile an FLA can hang when the FLA's 
publish settings include a relative path in front of the filename. 
Changing the FLA's Publish Settings to just a filename fixes it.<br/><img title="" alt="" src="http://www.actionscript.org/resources/content_images/1505/publish.png" width="426" align="Baseline" border="0" height="651"/> ]]></description>
			<author>no@spam.com (Haik Sahakian)</author>
			<pubDate><![CDATA[Mon, 19 Apr 2010 00:00:00 CDT]]></pubDate>
			<guid isPermaLink="true">http://www.actionscript.org/resources/blogs/42/Ant-build-in-FDT-hangs-when-using-a-relative-path-in-front-of-the-FLA-filename.html</guid>
		</item>
		<item>
			<title><![CDATA[Styling HTML Text Links in Flex]]></title>
			<link>http://www.actionscript.org/resources/blogs/39/Styling-HTML-Text-Links-in-Flex.html</link>
			<description><![CDATA[Flex 3 appears to have a bug that ignores CSS formatting for link tags in html text. It prevents you from making an html link a different color from the text around it, for example.<br/><br/>However the bug only exists for pre-written CSS files - if you create a CSS object dynamically and attach it to the text control, the link styles work.<br/><br/>So to style an mx:Text control's links, you can use the code below to rewrite your CSS on the fly. The code looks in your CSS file for the style to apply to links, and from it creates a new CSS stylesheet to apply to the text control.<br/><br/>The hex value returned by toString(16) lacks leading zeros, but the CSS parser for dynamically created CSS does not require them like it does for pre-written CSS files, so it works fine.<br/><br/><img title="" alt="" src="http://www.actionscript.org/resources/content_images/1505/htmltext.jpg" width="413" align="Baseline" border="0" height="258"/><br/><br/>function attachLinkStyleToText(textControl:Text)  <br/>{  <br/>     // find the CSS class containing the formatting you want to apply to links in the text  <br/>     var linkColorClass:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".yourHTMLLinkClassName");  <br/>     if (!linkColorClass) return;  <br/>   <br/>     // find the style you wish to apply, in this case just the color  <br/>     var linkColor:Number = parseInt(linkColorClass.getStyle("color"));  <br/>     if (!linkColor) return;  <br/>     var linkColorHex:String = linkColor.toString(16);  <br/>   <br/>     // create a new CSS style sheet that applies this style  <br/>     var linkCSSText:String = "a {color:#"+linkColorHex+"}";  <br/>     var linkCSS:StyleSheet = new StyleSheet();  <br/>     linkCSS.parseCSS(linkCSSText);  <br/>   <br/>     // attach the new CSS to the text control  <br/>     textControl.styleSheet = linkCSS;      <br/>}<br/><br/>]]></description>
			<author>no@spam.com (Haik Sahakian)</author>
			<pubDate><![CDATA[Mon, 29 Mar 2010 00:00:00 CDT]]></pubDate>
			<guid isPermaLink="true">http://www.actionscript.org/resources/blogs/39/Styling-HTML-Text-Links-in-Flex.html</guid>
		</item>
	</channel>
</rss>