13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Using the Flash Text Engine<br />

public var headline:String = "News Layout Example";<br />

public var subtitle:String = "This example formats text like a newspaper page using the<br />

Flash Text Engine API. ";<br />

public var rawTestData:String =<br />

"From the part Mr. Burke took in the American Revolution, it was natural that I should<br />

consider him a fri<strong>en</strong>d to mankind; and as our acquaintance comm<strong>en</strong>ced on that ground, it would<br />

have be<strong>en</strong> more agreeable to me to have had cause to continue in that opinion than to change it. " +<br />

"At the time Mr. Burke made his viol<strong>en</strong>t speech last winter in the English Parliam<strong>en</strong>t<br />

against the Fr<strong>en</strong>ch Revolution and the National Assembly, I was in Paris, and had writt<strong>en</strong> to him<br />

but a short time before to inform him how prosperously matters were going on. Soon after this I<br />

saw his advertisem<strong>en</strong>t of the Pamphlet he int<strong>en</strong>ded to publish: As the attack was to be made in a<br />

language but little studied, and less understood in France, and as everything suffers by<br />

translation, I promised some of the fri<strong>en</strong>ds of the Revolution in that country that wh<strong>en</strong>ever Mr.<br />

Burke's Pamphlet came forth, I would answer it. This appeared to me the more necessary to be<br />

done, wh<strong>en</strong> I saw the flagrant misrepres<strong>en</strong>tations which Mr. Burke's Pamphlet contains; and that<br />

while it is an outrageous abuse on the Fr<strong>en</strong>ch Revolution, and the principles of Liberty, it is<br />

an imposition on the rest of the world. " +<br />

"I am the more astonished and disappointed at this conduct in Mr. Burke, as (from the<br />

circumstances I am going to m<strong>en</strong>tion) I had formed other expectations. " +<br />

"I had se<strong>en</strong> <strong>en</strong>ough of the miseries of war, to wish it might never more have exist<strong>en</strong>ce<br />

in the world, and that some other mode might be found out to settle the differ<strong>en</strong>ces that should<br />

occasionally arise in the neighbourhood of nations. This certainly might be done if Courts were<br />

disposed to set honesty about it, or if countries were <strong>en</strong>light<strong>en</strong>ed <strong>en</strong>ough not to be made the<br />

dupes of Courts. The people of America had be<strong>en</strong> bred up in the same prejudices against France,<br />

which at that time characterised the people of England; but experi<strong>en</strong>ce and an acquaintance with<br />

the Fr<strong>en</strong>ch Nation have most effectually shown to the Americans the falsehood of those prejudices;<br />

and I do not believe that a more cordial and confid<strong>en</strong>tial intercourse exists betwe<strong>en</strong> any two<br />

countries than betwe<strong>en</strong> America and France. ";<br />

public function StoryLayout(w:int = 400, h:int = 200, cols:int = 3, padding:int =<br />

10):void<br />

{<br />

this.preferredWidth = w;<br />

this.preferredHeight = h;<br />

}<br />

this.numColumns = cols;<br />

this.paddingLeft = padding;<br />

this.paddingRight = padding;<br />

this.paddingTop = padding;<br />

this.paddingBottom = padding;<br />

var req:URLRequest = new URLRequest("story.css");<br />

loader = new URLLoader();<br />

loader.addEv<strong>en</strong>tList<strong>en</strong>er(Ev<strong>en</strong>t.COMPLETE, onCSSFileLoaded);<br />

loader.load(req);<br />

public function onCSSFileLoaded(ev<strong>en</strong>t:Ev<strong>en</strong>t):void<br />

{<br />

this.sheet = new StyleSheet();<br />

this.sheet.parseCSS(loader.data);<br />

// convert headline styles to Elem<strong>en</strong>tFormat objects<br />

h1_ElFormat = getElFormat("h1", this.sheet);<br />

Last updated 6/6/2012<br />

418

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!