Loading and Saving XML

This is a demo I created to demonstrate how to load and save data to an XML file. In the demo below you can add and remove balls as well as change their color. When you are finished you can click on “save” which saves your work into an XML file.

<?xml version="1.0" encoding="UTF-8"?>
<balllist>
<ball>

<id>0</id>
<x>80</x>
<y>50</y>
<c>0xFF0000</c>
<m>50</m>
</ball>
<ball>

<id>1</id>
<x>330</x>
<y>150</y>
<c>0x00FF00</c>
<m>100</m>
</ball>
<ball>

<id>2</id>
<x>450</x>
<y>70</y>
<c>0x0000FF</c>
<m>75</m>
</ball>
</balllist>

The XML file is then loaded using the following AS3 code. The data from the XML file is stored into an array “b” so that it can be easily accesssed and modified within the program.

var b : Array = new Array();
var loader : URLLoader = new URLLoader(); // used to load xml file
var xml : XML; // used to store XML data

loader.addEventListener(Event.COMPLETE, loadXML);
loader.load(new URLRequest("balls.xml"));

// gets executed when xml data has been loaded
function loadXML(e : Event) : void {

var i : int;
var n : int;

xml = new XML(e.target.data);
xml.ignoreWhitespace = true;
n = xml.ball.length(); // # of balls in XML file
// load xml data into ball array
for (i = 0; i < n; i++) {
b[i].x = xml.ball[i].x;
b[i].y = xml.ball[i].y;
b[i].c = xml.ball[i].c;
b[i].m = xml.ball[i].m;
}
}

To save the file, I just created a big string containing the XML code and sent it to a PHP routine via the “POST” method:

// saves the xml
function saveXML(e : Event) : void {

var s : String; // string containing XML
var h : String; // string to create a hexadecimal value for colours
var i : int;

// create xml as a string
s = '<balllist>n';
for (i = 0; i < b.length; i++) {
s = s + "t<ball>n";
s = s + "tt<id>" + i + "</id>n";
s = s + "tt<x>" + b[i].x + "</x>n";
s = s + "tt<y>" + b[i].y + "</y>n";
h = b[i].c.toString(16);
while (h.length < 6) {
h = "0" + h;
}
s = s + "tt<c>0x" + h + "</c>n";
s = s + "tt<m>" + b[i].m + "</m>n";
s = s + "t</ball>n";
}
s = s + "</balllist>";

// pass string to php routine which saves the data, using POST method
var req : URLRequest = new URLRequest();
var loader : URLLoader = new URLLoader();

req.data = s;
req.contentType = "text/xml";
req.method = URLRequestMethod.POST;
req.url = "SaveXML.php";
loader.load(req);
}

Finally I created a really simply PHP routine and saved it in a file called “SaveXML.php”. It simply dumps all of the text which was passed to it from Flash into the “balls.xml” file. Here is the code:

<?php

// simple routine to save xml file
// passed a large string from flash using post method

if (isset($GLOBALS["HTTP_RAW_POST_DATA"])) {
$xml = $GLOBALS["HTTP_RAW_POST_DATA"];
$file = fopen("balls.xml","wb");
fwrite($file, $xml);
fclose($file);
}

?>

Open letter to @Adobe & Adobe AIR

This letter was written by Gary Paluk:

Re: http://blogs.adobe.com/digitalmarketing/web-experience/adobe-experience-manager-mobile-app-announcement/

The following message was originally posted on facebook:
https://www.facebook.com/garypaluk/posts/10152028727336149

Hi Loni, firstly, thank you for your response to questions. I was a developer of the Away3D TypeScript HTML5 project which was funded by Adobe. I wrote my own Flash/Air 3D engine called Zest3D which had no funding from Adobe, so I’m in quite a good position to comment given my experience with the technologies being discussed.

The comments here illustrate just how concerned developers are, developers that have invested in Adobe technology over the years. I have invested 13 years of my own development career in Adobe products and evangelized the technology over that time. Your users can see that there is a perfectly good technology that does more than the new HTML5 offerings and they are evidently frustrated that you are not supporting developers that do not see why they aught to retrain to use an inferior technology.

Whilst I understand business choices are being made to support HTML5, Adobe should understand developers will leave rather than use inferior technology. I, for one, would resent moving to your HTML5 technology and every highly skilled developer that I have spoken to has said the same. You can see that in the comments already received.

Many of those developers feel that Adobes evangelist attitude to HTML5 is misplaced and a PR/market bending directive that is damaging their livelihoods and the skill-sets that they have accumulated and as most people would understand, developers and artists want to use the best products and workflows to get a job complete. In this case, the best product is Adobe Air and certainly not PhoneGap. So why do we keep seeing Adobe pushing the technologies that the developers do not want?

I would like to take the opportunity to ask Adobe to speak out and offer their support to existing developers with serious PR and coverage and continued accelerated roadmap for the Adobe Flash and Air product before all of your best developers leave and take their years of development and programming skills with them. Adobe has seen this already as developers have sought to find other native solutions, Unitiy has become the entry level tool of choice and companies like myself and Minko are essentially planning or working on building superior tools that may soon make Air obsolete whilst supporting native and HTML5 development without the need for an Adobe toolchain. This is the effect of alienating your development community and losing sales of your supporting tools.

Personally, I do not want to see Adobe Air or Adobe Flash disappear as they both have a formidable user base, excellent workflow, perfect cross-platform capability. With a small amount of investment, I feel that Flash and Air could be a much superior technology and with this approach Adobe might regain the trust of their developer community whilst continuing to enrich the lives of those developers who have continued to champion Adobes history of excellent web technologies.

Gary Paluk
http://www.plugin.io

Develop Android and iOS applications using Adobe Flex & AIR

As an iOS native app developer, I hate to write hybrid applications using third party frameworks. However, one day, I was assigned a task of building and testing a hybrid application on iOS and Android which was developed using Adobe Flex and AIR. In a sense, this marked the beginning of my suffering due to the poor performance of the final application as well as the complexity of the development process, compared with native development using the official iOS and Android SDKs. After a few weeks spent on studying new concepts such as Flash Player, Flex application, AIR SDK, AIR, etc, I finally finished the task, and decided to write this article to share my knowledge with other users who may be having the same problem.

Basic concepts

The following diagram demonstrates the basic architecture of an Adobe AIR application. iOS/Android applications built using AIR will have the Adobe AIR runtime included with their binaries, providing support for ActionScript classes which forms the basics of  Adobe AIR/Flex applications.

Adobe Flash (formerly called MacromediaFlash and Shockwave Flash) is a multimedia and software platform used for creating vector graphics, animation, browser games, rich Internet applications, desktop applications, mobile applications and mobile games.

Flex is an integrated collection of stylable graphical user interface, data manipulation and networking components, and applications built upon it are known as “Flex” applications. Flex GUIs are defined in MXML, similar to how Android and Microsoft Visual Studio define GUIs. In 2004, Macromedia Flex was released and specifically targeted the application development market. The Flex SDK includes the Flex framework (also known as the Flex class library), Flex command-line compilers, the Flex debugger, the ASDoc utility, and the debugger version of Adobe® Flash® Player and Adobe® AIR® runtimes.

AIR (formerly Adobe Integrated Runtime) is a cross-platform runtime system developed by Adobe Systems for building desktop applications and mobile applications, programmed using Adobe Flash, ActionScript and optionally Apache Flex.

Adobe AIR is a cross-operating-system runtime that lets developers combine HTML, JavaScript, Adobe Flash® and Flex technologies, and ActionScript® to deploy rich Internet applications (RIAs) on a broad range of devices including desktop computers, netbooks, tablets, smartphones, and TVs. AIR allows developers to use familiar tools such as Adobe Dreamweaver®, Flash Builder®, Flash Catalyst®, Flash Professional, or any text editor to build their applications and easily deliver a single application installer that works across operating systems.

The AIR SDK contains framework for Adobe AIR APIs, template for the Adobe AIR application install badge, command-line Adobe AIR Debug Launcher (ADL), command-line Adobe AIR Developer Tool (ADT)

The main difference between Flex and AIR is that Flex, unlike AIR, does not give access to native GUI components.

Build iOS/Android app with Flex SDK using Flash Builder 4.7

In this part, I will show you how to use Flash Builder to build a simple “Hello World” application that can run on the iOS simulator.

First, install the Flash Builder(FB) with Adobe Creative Cloud, which can take a long time due to large download size.

 

 

 

 

 

 

 

 

 

Then, follow the steps in this link to build a simple “Hello World” application. When done, try to launch the application and you will encounter the first challenge – error message “iOS Simulator launch requires AIR SDK 3.4 or above” is shown:

To find out the reason of this error, click on “Learn more” which says

“Adobe Flex SDK 4.6 and Apache Flex SDK 4.8 contain AIR 3.1. When you create Flex projects using these SDKs, AIR 3.1 applications are created. And, you can’t use features that are specific to AIR 3.4. To use the AIR 3.4 features, you can overlay the AIR 3.4 SDK on the Flex SDK”

The reason this happens is because AIR 3.4 is a very old version. To find out how old it is, check the AIR SDK version archive here. To fix this error, we are going to use the latest version of AIR, v18.0.0 as at Aug 2015. Following the following steps to get this done:

1. Download the original AIR SDK without compiler version 18.0 at the bottom of this page http://www.adobe.com/devnet/air/air-sdk-download.html

2. Extract the downloaded package and check “AIR SDK Readme.txt” to make sure you have downloaded the right version.

 

 

 

 

 

 

3. Update the preinstalled AIR SDK files with the new files using ditto command in 2 directories:

  • ditto ~/Downloads/AdobeAIRSDK /Applications/Adobe\ Flash\ Builder\ 4.7/sdks/4.6.0
  • ditto ~/Downloads/AdobeAIRSDK/Applications/Adobe\ Flash\ Builder\ 4.7/eclipse/plugins/com.adobe.flash.compiler_4.7.0.349722/AIRSDK/

The “ditto” command replaces the existed files inside destination directories recursively.

4. The AIR SDK is now up-to-date and can be used to launch your app on the iOS simulator.

Building from the command line

The following diagram demonstrates the process of building an iOS application from Flex:

To achieve this from the command line, follow the following steps:

1. Creates the SWF file which is the final target of Adobe Flash Platform

amxmlc -swf-version 27 +configname=airmobile \
-include-libraries=libs/some_tools.swc,libs/an_extension.ane \
src/hello_world_application.mxml \
-output ./bin-debug/HelloWorld.swf

– HelloWorld_application.mxml is markup language file which combines with ActionScript to make application.
– an_extension.ane is a native extension which help AIR application access native function of platform. It’s optional.
– HelloWorld.as and other file .as are the logic implementation of AIR application.

2. Package all data into a single file – HelloWorld.ipa

adt -package -target ipa-test-interpreter \
-provisioning-profile ./a_path/ios.mobileprovision \
-storetype pkcs12 -keystore ./a_path/cer.p12 -storepass “password of cer.p12″ \
../bin-debug/HelloWorld.ipa src/HelloWorld-app.xml \
-extdir libs src/GeoComplyClientTest.swf libs/another_tool.swc

target ipa-test-interpreter’ specifies the output type of ipa. This is functionally equivalent to a debug package, but compiles more quickly. However, the ActionScript bytecode is interpreted and not translated to machine code. As a result, code execution is slower in an interpreter package. You can check all possible target types by command “adt -help”

To complete code signing, you will need provide the provisioning profile and the private key in.p12 format.

Building with AIR Native Extension (ANE)

The overall process and required command line is summarized in the following diagram:

The provided command line are for iOS build, which generates an IPA file. If you are building the .APK file for Android, you will need to modify the commands slightly.

Adobe Flash Player 13 Beta Now Available for Download

Adobe has just rolled out a new beta version of Flash Player that allows users to try out the feature lineup that’ll be soon integrated into the application a lot earlier.

Adobe Flash Player 13.0 beta comes with supplementary characters enhancement support for TextField, as well as with full screen video message tweaks to customize the notification appearing on your monitors when watching a clip in full screen.

Of course, don’t forget that this release is still a beta build, so a number of bugs might still be experienced. Still, it’s a good chance for users to try out the next version of the app,  so download Adobe Flash Player 13.0.0.80 Beta right now to see what it brings new.

New and Updated Features

  • Enhanced Supplementary Character Support for TextField

Characters from the Basic Multilingual Plane (BMP) with Unicode code points between U+10000 and U+10FFFF nowl work correctly in T

extField controls. This change greatly enlarges the code point range we support, and now includes characters like emoticons and

complex CCJK characters.

  • Relocated Full Screen Video Warning to Top of Screen

We have made a small tweak to the “Press Esc to exit full screen mode” warning that is displayed for full screen video. We’ve received a

lot of feedback from developers because the dialog obscures content, and we wanted to make a change that both satisfies security

concerns and customer viewing enjoyment. To reduce the impact of the dialog on the on-screen content, we’ve moved the dialog to the

top of the screen.

  • New Stage3D Texture Wrapping Modes

Developers can currently set the wrapping mode of a texture to either clamp or repeat. Using the repeat option will repeat the texture on

both the U and V axis. However, in some use cases, you may only want to repeat the texture on either the u or v axis.

This is now possible with the introduction of two new parameters:

REPEAT_U_CLAMP_V and CLAMP_U_REPEAT_V

  • Stage3D Anti-Aliasing for Texture Rendering

Anti-Aliasing is a useful for improving perceived image quality. Hardware based Multisampling Anti-Aliasing (MSAA) is now available on

all desktop platforms. To enable MSAA, set the level from 0 to 4 using the new Context3D.setRenderToTexture() method.0 = 1 subsamp

le, no antialiasing

• 1 = 2 subsamples , minimal antialiasing

• 2 = 4 subsamples , medium high-quality antialiasing

• 3 = 8 subsamples , high-quality antialiasing

• 4 = 16 subsamples , very high-quality antialiasing

Why ActionScript 3.0 should be your first programming language

 ActionScript 3.0, is the best programing language for somebody just learning programing!

ActionScript sounds like a weird choice, right? It’s client-side, not server-side. You can’t connect to a database or create files on the fly without some sort of middleware (like java or ColdFusion).  ActionScript 3.0 can also create AIR applications that can be deployed everywhere, the desktop, iOS, and Android! ActionScript 3.0 is write once deploy everywhere.

I think ActionScript 3.0 is worth learning, and that it’s a great starter language for budding developers. Here’s why.

  • ActionScript 3.0 is syntactically similar to other C-style languages.
    Curly braces rule! Semi-colons are awesome! Getting comfortable with how AS3 looks and works will make Java less intimidating.
  • ActionScript 3.0 is strongly-typed.
    Strongly typed languages enforce rules for variable behavior. It’s particularly useful when debugging, and will help you understand what different variable types are and how they work across languages.
  • ActionScript 3.0 is Object oriented.
    Objects are at the heart of several programming languages, and supported in several more. Getting comfortable with how OOP works in AS 3 means it is easier to understand how it works in Java and other programming languages. In fact, ActionScript is in some ways similar to Java in how it’s structured.
  • ActionScript 3.0 is a dialect of ECMAScript.
    You can treat ECMA Script as a kind of subset that defines the basic language structure, syntax and semantics. Then ECMA is only a subset of ActionScript. The language adds a wide range of features to this subset.
  • ActionScript 3.0 supports Local Shared Objects
     Yep. Local storage “super cookies” have been available in Flash for years now. What’s more, key-value datastores are the next wave of databases.
  • ActionScript 3.0 supports event-driven programming.
    Event listening and handling is critical to game development or interactive experiences in which the sequence of user input can’t be (or shouldn’t be) controlled. Knowing how to generate, add and remove elements from the stage, or when an item can be safely garbage collected are portable concepts that you can learn with ActionScript.

Flash Player 12.0 and AIR 4.0 Release Notes

Welcome to Adobe® Flash® Player 12.0 and Adobe AIR 4.0!

Last Updated: December 17th, 2013

Code-named “Jones”

Announcement: We are moving to a rapid beta release cycle using “Background Update“. We encourage you to subscribe so you can get the latest and the greatest Flash Player without a single mouse click. You may also subscribe to our Twitter channel @FlashPlayerBeta to stay on top of the current release schedule updates.

This beta release includes new features as well as enhancements and bug fixes related to security, stability, performance, and device compatibility for Flash Player 12 and AIR 4. This document may be updated periodically as more information becomes available.

With this release, we are introducing a new numbering scheme for our product versions. Adopting the pattern set by Google with Chrome and Mozilla with Firefox, we will simply update the major version number with each subsequent release. In other words, beginning with the release of “Jones”, Flash Player will become Flash Player 12.

With each new major release, roughly every 3 months, that number will increase by one.

This change will also apply to AIR and the AIR SDK, albeit not right away. Our “Jones” release will be numbered AIR 4 and AIR SDK 4; however, with our “King” (Q2 2014) release, the version number will be synchronized with the Flash Player version at 13.
Last Updated: December 17th, 2013

Thank you for testing our upcoming releases and we encourage you to let us know what you think on our beta forums and bug-database.

NOTE:
The ActiveX Flash Player in this release is NOT compatible with Windows® 8.

  • Flash Player for Windows® 8 is available as part of the generally available Windows® 8

Builds changes
Runtime Versions

Flash Player Desktop only: 12.0.0.39
AIR Runtime Desktop: 4.0.0.1390
AIR Runtime Android: 4.0.0.1390
AIR SDK & Compiler: 4.0.0.1390  NOTE: AIR SDK & Compiler (now includes iOS7 support)

(December 17th, 2013) This update includes new iOS and Android features, enhancements and bug fixes.

Flash Player 12.0 beta

(Decenber 17th, 2013This update included security enhancements and bug fixes to provide a more robust and secure Flash Player.

Is a Graphic Design Degree Worth It?

After weeks, months or even years of deliberation, you’ve finally decided to follow your dream of becoming a graphic designer. Many people spend their whole lives working an ordinary job, so the fact that you’ve chosen to pursue your dream job is an accomplishment in and of itself.

The next logical step is to plan out your path to success. During this planning process, nearly every graphic design hopeful has asked the same question: Is a graphic design degree worth it?

For many professions, acquiring a formal education is non-negotiable. For example, a pilot or an orthopedic surgeon doesn’t have the option to bypass the formal instructions or teach themselves the tricks of the trade.

But as an aspiring graphic designer, you need to decide if you want to earn a degree or be a self-taught designer. It’s a difficult choice to make because there is no clear-cut answer. Both types of designers have found success in the industry.

Is a graphic design degree necessary? No. There are plenty of YouTube tutorials and step-by-step articles that can help introduce you to the industry and walk you through basic skills training. But is a graphic design degree worth it? If you aspire to make a splash in the industry, the answer is yes!

The benefits of earning a graphic design degree

While it may seem quick and easy to jump right in and learn as you go, there are clear benefits that come with taking the time to earn a graphic design degree. From the knowledge and instruction you receive while in school to the opportunities available to you after graduation, the advantages are abundant.

You will likely have more job opportunities after graduation

graphic-design-job-openings-with-degreeNo matter what the profession, one of the biggest concerns anyone has when pursuing a new career is whether or not they’ll be able to find a job. As you leave behind one job, you want to be confident there will be one waiting for you on the other side.

One of the most important things you can do to increase your employment potential is earn a graphic design degree. Often this is the first thing a hiring manager looks for when considering a design candidate.

While anyone can learn the basics of design software, a degree shows an employer that you’re serious enough to invest in your personal development. Without even seeing your portfolio, having a degree listed on your resume demonstrates your self-worth and commitment to evolve as a graphic designer.

In fact, many hiring managers won’t even consider hiring a designer unless he or she has earned a degree. An analysis of more than 15,000 graphic design jobs posted throughout the past year showed that 82 percent preferred candidates to have a bachelor’s degree.*

The chart illustrates the number of job opportunities for graphic designers with a bachelor’s degree versus those without a degree. You’ll see that earning a bachelor’s degree would qualify you for more than 13,000 more graphic design jobs than an individual with no degree.

This means graphic design degree holders are eligible for nine times more jobs than those without a degree. Who doesn’t like those odds?

You can earn more money

We’ve all heard the saying: Money can’t buy happiness. But there are plenty of things that money can buy, such as your son’s braces, your monthly gym membership and your never-ending grocery list.

Let’s face it, you’d be lying if you said you couldn’t use a higher salary. You’ll be happy to hear that not only does a degree qualify you for more jobs, it can also help you earn more money!

Across most industries, it’s a generally accepted fact that the more education you obtain, the more money you’ll earn. Research has found that bachelor’s degree recipients earn nearly $1 million more in their lifetime than those with a high school diploma.

But have you ever seen a study focused exclusively on the graphic design industry?

The annual salary range for all graphic design specialists is roughly $38,000 to $61,000 according to Salary.com. By acquiring a graphic design degree, you can make nearly $10,000 more per year than if you had no college experience. Just imagine what you could do with that extra money in your pocket!

Understanding the theory of graphic design will make you more marketable

“Graphic design is so much more than just slapping some pictures and words together,” A formal education provides you with all of the tools you need to become a well-rounded professional and succeed in the industry.

It’s relatively common these days for inexperienced users to call themselves “graphic designers” after picking up a few tricks in Photoshop. But in reality, graphic design is more than just mastering the software. You should be trained not only in the technical skills, but also in the theory, history and traditions of the industry.

For instance, did you know that different colors trigger emotional reactions in people? Blue is seen as reliable and trustworthy, while yellow symbolizes happiness and positive energy. The study of color theory helps designers pinpoint the precise messages they wish to convey to their audience.

This is just one example of the invaluable knowledge you’d gain in school that cannot be learned in a Photoshop tutorial. A true designer can explain not only how they did something, but why they did it.

You can develop your skills and portfolio under expert direction

Another perk of earning a graphic design degree is that you have the unique opportunity to sharpen your skills alongside industry experts. Most graphic design programs employ faculty members who have years of experience under their belt.

Watching YouTube videos at home can’t compare to the priceless, hands-on instruction you could receive from an expert mentor. Their coaching goes so much deeper than just the content of the courses.

As a graphic design student, you’d also have the opportunity to build your portfolio alongside a seasoned professional. After receiving constant advice and feedback on your work, you can be confident that you’ll graduate with a professional portfolio.

The answer is clear…

While it is possible to launch your design career with no formal education, a graphic design degree will give you a head start towards becoming a true professional in the industry. Although pursuing a degree may delay your design career a bit, it could end up taking your career to a whole new level.

After learning the facts and hearing the benefits firsthand from other designers, you can be confident that going back to school can help you set the stage for a long, successful career.

So is a graphic design degree worth it? You decide!

Difference between Flex and Flash

There is not big difference between flex and flash. Flash is more oriented or specially designed software for designer because they can create anything without using any code. Coding is the advantage for the designer to save his time but he can also perform the same work without coding. Flash provides number of tools for drawing to create graphics or timeline method for changing those graphics according to the requirement. Flash is used to create web ads, banner for websites, banner for social messages, games, and so on. Using Action Script in the flash we can make our design more lively or realistic. The biggest disadvantage of flash is you have to spend countless hours for creating attractive framework for your project or website. It is really a time consuming process.

Where as flex is more oriented or created to keep in mind the developers. It has includes almost every feature of web development. Developers who have good knowledge of html, css and javascript or little bit designing knowledge can easily understand the flex. You can create graphics by using inbuilt components or functions. The prime function of php is to create business type applications. If you want create complex application in other software it will take number of hours to complete but flex provides the framework applications which includes inbuilt components to design or develop complex application and with the use of components you will save your time. You can use several languages in one application like mxml which is similar to html, action script or php, dotnet and so on. Flex compiles these languages in one SWF file. The only disadvantage of flex is that it doesn’t provide any tool for designing but with the use of stylesheet, properties or components we can develop or design attractive design for our applications.

Flash can be run on browser or as a desktop application. The Flex application is finally complied into Flash application. So, you can use Flex to develop web and desktop application. Flash also runs as desktop application, So, its now possible to create desktop application in Flex and then compile it as Flash desktop application.

Developers are using the xml editing tool to edit the Flex file. File file is based to the xml standard and it is saved as .mxml extension. You can use the Flex SDK to compile the .mxml file into a Flash file. Then Flash file can be run as desktop or web application.

My Flash Drawing

Well I have been practicing in my drawing skills in flash, and here is something that I made at a local coffee shop while enjoying my smoothie

[kml_flashembed fversion=”8.0.0″ movie=”http://blog.hawaiiflash.org/wp-content/uploads/2010/03/my_dude.swf” targetclass=”flashmovie” publishmethod=”static” width=”400″ height=”300″]

Get Adobe Flash player

[/kml_flashembed]