Skip to content

Commit

Permalink
fxg convertor to bitmap data
Browse files Browse the repository at this point in the history
  • Loading branch information
EliEladElrom committed Jul 22, 2011
1 parent 27923d4 commit 599fa09
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 0 deletions.
108 changes: 108 additions & 0 deletions bin-debug/ConvertFXGToBitmapData.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!--
Smart developers always View Source.
This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR.
Learn more about Flex at http://flex.org
// -->
<head>
<title></title>
<meta name="google" value="notranslate" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
the percentage of the height of its parent container, which has to be set explicitly. Fix for
Firefox 3.6 focus border issues. Initially, don't display flashContent div so it won't show
if JavaScript disabled.
-->
<style type="text/css" media="screen">
html, body { height:100%; }
body { margin:0; padding:0; overflow:auto; text-align:center;
background-color: #ffffff; }
object:focus { outline:none; }
#flashContent { display:none; }
</style>

<!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
<!-- BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css" />
<script type="text/javascript" src="history/history.js"></script>
<!-- END Browser History required section -->

<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "10.2.0";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
var params = {};
params.quality = "high";
params.bgcolor = "#ffffff";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "ConvertFXGToBitmapData";
attributes.name = "ConvertFXGToBitmapData";
attributes.align = "middle";
swfobject.embedSWF(
"ConvertFXGToBitmapData.swf", "flashContent",
"100%", "100%",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>
</head>
<body>
<!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
when JavaScript is disabled.
-->
<div id="flashContent">
<p>
To view this page ensure that Adobe Flash Player version
10.2.0 or greater is installed.
</p>
<script type="text/javascript">
var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
</script>
</div>

<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" id="ConvertFXGToBitmapData">
<param name="movie" value="ConvertFXGToBitmapData.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="ConvertFXGToBitmapData.swf" width="100%" height="100%">
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--<![endif]-->
<!--[if gte IE 6]>-->
<p>
Either scripts and active content are not permitted to run or Adobe Flash Player version
10.2.0 or greater is not installed.
</p>
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</noscript>
</body>
</html>
Binary file added bin-debug/ConvertFXGToBitmapData.swf
Binary file not shown.
Binary file modified bin-debug/Main.swf
Binary file not shown.
Binary file added bin-debug/mx_4.5.1.21328.swf
Binary file not shown.
35 changes: 35 additions & 0 deletions src/ConvertFXGToBitmapData.mxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600" xmlns:local="*">

<fx:Script>
<![CDATA[
import com.elad.optimize.utils.FXGHelper;
import spark.components.Group;
import spark.components.Image;
private function convertToBitmapData(group:Group):void
{
var bitmapData:BitmapData = FXGHelper.getBitmapData( group );
var bitmap:Bitmap = new Bitmap( bitmapData );
bitmap.smoothing = true;
var image:Image = new Image();
image.source = bitmapData.clone();
image.y = 50;
this.addElement( image );
}
]]>
</fx:Script>

<s:Button x="150" label="convert fxg2bitmap" click="convertToBitmapData(fxgAsset)" />

<s:Group id="fxgAsset" >
<local:FxgAsset />
</s:Group>

</s:Application>
18 changes: 18 additions & 0 deletions src/FxgAsset.fxg
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version='1.0' encoding='UTF-8'?>
<Graphic xmlns:fc="http://ns.adobe.com/flashcatalyst/2009" xmlns:d="http://ns.adobe.com/fxg/2008/dt" xmlns="http://ns.adobe.com/fxg/2008" xmlns:flm="http://ns.adobe.com/flame/2008" version="2.0">
<Group flm:knockout="false">
<Path winding="nonZero" x="1.278" y="1.271" data="M 0 7.782 L 7.654 0.126 C 8.75 0.828 10.005 1.196 11.309 1.196 C 12.697 1.196 14.019 0.784 15.155 0 L 22.936 7.781 L 11.468 19.25 L 0 7.782 Z">
<fill>
<LinearGradient rotation="90" scaleX="41.4187" x="11.468" y="-0.258">
<GradientEntry color="#FFDE17" ratio="0"/>
<GradientEntry color="#F4B321" ratio="1"/>
</LinearGradient>
</fill>
</Path>
<Path winding="nonZero" x="0.571" y="0.614" data="M 15.795 1.297 L 22.936 8.438 L 12.175 19.2 L 2.412 9.438 L 2.414 9.438 L 1.414 8.438 L 8.438 1.413 C 9.529 2.031 10.751 2.354 12.016 2.354 C 13.366 2.354 14.657 1.99 15.795 1.297 M 15.912 0 C 14.838 0.846 13.488 1.354 12.016 1.354 C 10.625 1.354 9.344 0.898 8.301 0.137 L 0.035 8.402 L 0 8.438 L 0.002 8.439 L 0 8.439 L 12.175 20.614 L 24.349 8.439 L 24.35 8.438 L 15.912 0 L 15.912 0 Z">
<fill>
<SolidColor color="#ED1C24"/>
</fill>
</Path>
</Group>
</Graphic>

0 comments on commit 599fa09

Please sign in to comment.