Menu:

BLOG FEED
FORUM FEED
TUTORIAL FEED

Sponsor

Place your advertising here
casininio casino online casino online Buy and sell flash files

Forum's topics

Latest Files

Archives

Top Rated

Categories

Photo Gallery


purePDF, a complete actionscript PDF library

By Alessandro Crugnola on February 3, 2010 | Permalink | TrackBacks (0) | Comments (8)
Tags: actionscript , java , library , pdf , purepdf
Categories: actionscript, flex, general

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 )
  • 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



Bookmark and Share

 

 

Update your app VERSION using ant

By Alessandro Crugnola on January 31, 2010 | Permalink | TrackBacks (0) | Comments (1)
Tags: ant
Categories: actionscript

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.
This is the way I do. In the "compile" task I've added a depends link to this ant task:


<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>

The 2 optional tasks I've used are: BuildNumber task and ReplaceRegExp Task. In this way every time I do an ant compile, it will update my build number and modification date.
What this task does is find this 2 lines in my Library.as file:

public static const BUILD_DATE: String = '20100131';

and

public static const BUILD_NUMBER: String = '5';


then replace the BUILD_DATE const with the current date and the BUILD_NUMBER with an incremental build number. After being executed the first time, ant will also create a new file in your directory called "build.number" with the latest build number int.


Bookmark and Share

 

 

Vector.splice bug

By Alessandro Crugnola on January 27, 2010 | Permalink | TrackBacks (0) | Comments (0)
Tags: bug , splice , tamarin , vector
Categories: actionscript

Ususally people complain about opensource projects because they lack of documentation ( that's true most of the times.. ), but this doens't happen only there...

Today I've spent a lot of time trying to understand why I was so stupid because I wasn't able to concatenate 2 vectors of int using splice.
But for what you can read from the *official* Adobe documentation, which says (about the third parameter for the splice method):

... 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.

Ok, that's why I didn't know why I couldn't manage to make it work! This simple code gives wrong results:

var v1: Vector.<int> = new Vector.<int>();

v1.push(1);

v1.push(2);

v1.push(3);

v1.push(4);


var v2: Vector.<int> = new Vector.<int>();

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


Bookmark and Share

 

 

Alchemy installation problems under OSX

By Alessandro Crugnola on January 7, 2010 | Permalink | TrackBacks (0) | Comments (1)
Tags: alchemy , darwin , gcc , grep , osx
Categories: actionscript

I’m writing this little issue I discovered today in the alchemy installation under OSX, in case someone else is having the same problem…

In fact, today I decided to makes a little swc library for an actionscript project using alchemy ( because of the lacks of union in flash ), so I downloaded the alchemy toolkit for OSX.
I spent a couple of hours trying to make it working on my Snow Leopard and because I’m not a shell and perl expert I finally moved to the linux toolkit under ubuntu ( even if on linux the Flex builder is really far to be usable!)

Anyway, this evening I decided to spend some more time trying to understand why when I was trying to execute the alchemy “gcc” script ( the ones inside the achacks folder, which is a perl script) nothing happened.
After long time with old style “print” debugging strategy, at the end I discovered an error in the “config” script in the main alchemy installation folder.

At this line (line 33):
if echo $MACHTYPE | grep darwin &> /dev/null; then

I had to modify it into:
if echo $MACHTYPE | grep -i darwin &> /dev/null; then

because the command “echo $MACHTYPE” outputs “x86_64-Apple-Darwin”, with the uppercase “D”.

In fact, after that modification everything finally worked!

Bookmark and Share

 

 

Flex 3 Tree double-click to edit

By Alessandro Crugnola on December 23, 2009 | Permalink | TrackBacks (0) | Comments (0)
Tags: double-click , tree
Categories: flex

Some people asked about changing the default editing behavior of a Flex 3 Tree control so  that item editing starts on a double-click event instead of the default single click.
Indeed it has been covered several times on forums or mailing list, but it's faster to create a simple script than search for it sometimes.

Here's the files:

Bookmark and Share

 

 

Flash Player 10.1 and global error handling

By Alessandro Crugnola on December 15, 2009 | Permalink | TrackBacks (0) | Comments (0)
Tags: exception , flashplayer 10.1 , IPhone , Programming , smartphones
Categories: actionscript, flash

Well, it seems that the upcoming flashplayer 10.1 (first half of 2010?) has been completely designed to fill the gap that the current flashplayer has with the smartphones world (multitouch, accelerometer, screen orientation, sleep mode, out-of-memory management, etc..).
There will be a lot of new useful features, if you look at the release note pdf: http://labs.adobe.com/technologies/flashplayer10/releasenotes.pdf

But the most important feature, for me (as I asked a little time ago), is indeed the global error handling!
Unfortunately the global error handling feature hasn't been already implemented in the current prerelease public version. I hope they will enable this feature soon, I really miss this option!

Bookmark and Share