Recently I decided to write my old flash tracer firefox extension from scratch because I found it not really useful (at least for me) and too “expensive”, moreover when using firebug at the same time.
Flex sdk 3.5.0 problem with ternary operators
package { import flash.display.Sprite; public class ternary_test extends Sprite { public function ternary_test() { var n: Number = 0; var d: int = 3; var k: int = 5; var j: int = 10; n = 1 + ( -( d == 0 ? k : j ) ); trace( "n=" + n ); } } }
will cause the compiler to crash with the following stack trace:
compile: [mxmlc] Loading configuration file /Applications/Adobe Flash Builder 4 Plug-in/sdks/3.5.0/frameworks/flex-config.xml [mxmlc] Error: null [mxmlc] java.lang.NullPointerException [mxmlc] at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:1290) [mxmlc] at macromedia.asc.parser.UnaryExpressionNode.evaluate(UnaryExpressionNode.java:51) [mxmlc] at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2153) [mxmlc] at macromedia.asc.parser.ListNode.evaluate(ListNode.java:44) [mxmlc] at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:1497) [mxmlc] at macromedia.asc.parser.BinaryExpressionNode.evaluate(BinaryExpressionNode.java:56) [mxmlc] at macromedia.asc.semantics.ConstantEvaluator.evaluate(ConstantEvaluator.java:2124) [mxmlc] at macromedia.asc.parser.ArgumentListNode.evaluate(ArgumentListNode.java:45)...
PdfReader for purePDF
Recently I’ve update purepdf adding PdReader.
- Extract bookmarks
- Extract text
- Extract images
- ExtractTextPDF.air (air application): browse for local pdf documents and display pages contents
mm.cfg revealed!
I’ve just discovered an unbelievable post by Jean-Philippe Auclair with ALL the undocumented options of the mm.cfg file!
- AllowUserLocalTrust
- AS3AllocationTracking
- AS3AutoStartSampling
- AS3CSE
- AS3DCE
- AS3DynamicProfile
- AS3MIR
- AS3Sampling
- AS3SSE
- AS3StaticProfile
- AS3Trace
- AS3Turbo
- AS3Verbose
- AssetCacheSize=X
- AutoUpdateDisable
- AutoUpdateInterval
- AutoUpdateVersionUrl
- AVHardwareDisable
- CodeSignLogFile
- CodeSignRootCert
- Convert8kAnd16kAudio
- CrashLogEnable
- DisableAVM1Loading
- DisableDeviceFontEnumeration
- DisableIncrementalGC
- DisableMulticoreRenderer
- DisableNetworkAndFilesystemInHostApp
- DisableProductDownload
- DisableSockets
- DisplayGPUBlend
- EnableIncrementalValidation
- EnableLeakFile
- EnableSocketsTo
- EnableSocketsTo
- EnableSocketsTo
- EnforceLocalSecurityInActiveXHostApp
- ErrorReportingEnable
- FileDownloadDisable
- FileUploadDisable
- ForceGPUBlend
- FrameProfilingEnable
- FullScreenDisable
- GCStats
- GPULogOutputFileName
- HeapProfilingAS3Enable
- LegacyDomainMatching
- LocalFileLegacyAction
- LocalFileReadDisable
- LocalStorageLimit
- LogGPU
- MaxWarnings
- OverrideGPUValidation
- OverrideUserInvokedActions
- PolicyFileLog
- PolicyFileLogAppend
- PreloadSwf
- PreloadSwf
- ProductDisabled
- ProductDownloadBaseUrl
- ProfileFunctionEnable
- ProfilingOutputDirectory
- ProfilingOutputFileEnable
- RendererProfilingEnable
- RTMFPP2PDisable
- RTMFPTURNProxy
- ScriptStuckTimeout
- SecurityDialogReportingEnable
- SuppressDebuggerExceptionDialogs
- ThirdPartyStorage
- TraceOutputBuffered
- TraceOutputFileEnable
- TraceOutputFileName
- UseBrokerProcess
- WindowlessDisable
Flash alpha GradientMatrix to PDF using purePDF
One of the most hard thing to traslate when creating pdf documents from existing flash movies is indeed the gradient matrix.
var cb_shading: PdfShading = PdfShading.complexAxial( writer, top_left.x, top_left.y, top_right.x, top_right.y, cb_colors, cb_ratios, true, true );
then for the alpha masking I’ve created a PdfTransparencyGroup applied to the alpha mask.
purePDF, a complete actionscript PDF library
PurePDF is a complete library for creating PDF documents using actionscript 3 ( targeted for flash player 10 ).
The project is actually hosted on google code.
This is is a porting I’ve made of the famous java iText library ( version 4.2 ) by Bruno Lowagie into pure actionscript 3.0 (with some little modifications).
iText ( and purePDF ) has tons of features for create and manipulate pdf documents. A quick list of the features actually implemented into purepdf:
- pdf viewers display options
- alpha transparency, blend modes
- layers
- arabic RTL writing
- support for pdf text rendering ( example )
- tables ( nested tables, page split tables, table with images, etc…)
- slide show ( page transitions )
- annotations, comments, file annotations
- patterns, shadings patterns (linear and gradient), spot colors, rgb color and cmyk color
- linear and radial gradients with alpha ( example or example 2 )
- forms (user input forms, textfields, combo box, list, checkbox)
- paragraphs, phrases, chunks for text manipulation, chapters, lists…
- images (jpeg, png, animated gif, tif, bitmapdata ) and image patterns
- basic and advanced paths
- afm, otf, pfm, ttc and ttf fonts (embedded and not embedded)
- metadata, page header and footers
- external, internal links
- barcodes creation ( ean-ucc 13, ucc-12, ean-ucc-8, upc-e, pdf 417, ean supplements) ( example )
- unicode, cjk fonts and text
- file attachments
- javascript ( example )
- multi column text
- Embedded movies ( example )
- Vertical text ( see this example )
- and many other features…
You can take a look at this PDF document (self generated using actionscript reflection) with the purePDF APIs.
Other actionscript libraries I’ve used for this project are: fzlib, as3corelib, ashashmap, alchemy, as3-commons.
You can both download the library from source code and compile it yourself ( see at the Installation guide ) or download the precompiled swc files from the project’s download section.
Moreover there are actually a lot of examples to explain all the library features and for a quick guide. You can find them listed and updated here. In General refers to the project wiki for all the updated examples/howtos and the project updates.
update: here you can find the updated online api documentation
Update your app VERSION using ant
This is just a quick tip in case someone needs it. Maybe when you compile your flash application or your swc library you want to automatically update the “VERSION” number too without do it manually every time.
<target name="update-version"> <propertyset id="tdate"></propertyset> <tstamp> <format property="tdate" pattern="yyyyMMdd"/> </tstamp> <buildnumber file="build.number"/> <echo>updating version to current datetime: ${tdate}</echo> <replaceregexp byline="true"> <regexp pattern="public static const BUILD_DATE: String = \'([0-9]+)'"/> <substitution expression="public static const BUILD_DATE: String = '${tdate}'"/> <fileset dir="src/it/sephiroth/somestuff"> <include name="Library.as"/> </fileset> </replaceregexp> <replaceregexp byline="true"> <regexp pattern="public static const BUILD_NUMBER: String = \'([0-9\.]+)'"/> <substitution expression="public static const BUILD_NUMBER: String = '${build.number}'"/> <fileset dir="src/it/sephiroth/somestuff"> <include name="Library.as"/> </fileset> </replaceregexp> </target>
public static const BUILD_DATE: String = ‘20100131’;
and
public static const BUILD_NUMBER: String = ‘5’;
Vector.splice bug
Usually people complain about opensource projects because they lack of documentation ( that’s true most of the times.. ), but this doens’t happen only there…
… items — An optional list of one or more comma-separated values, **or a Vector**, to insert into the Vector at the position specified in the startIndex parameter.
var v1: Vector.
v1.push(1);
v1.push(2);
v1.push(3);
v1.push(4);
var v2: Vector.
v2.push(100);
v2.push(200);
v1.splice( 1, 1, v2 );
// Expected result: [1,100,200,3,4]
// Actual result: [1,0,3,4]
It seems that the third parameter is being casted into int and so only ‘0’ has been inserted into the first Vector!
I tried to look into Adobe jira bugbase and what I’ve found there is that it was a known bug since long time and it has been also moved to the tamarin bugbase.
The problem is that at the end they simply closed the bug as invalid bug because the documentation was wrong!
Funny