Dec

24

Posted by : admin | On : December 24, 2011

Hello and welcome to my blog, my name is Shane Hogan and I am the developer behind ScaleViz – A Theory App designed for Guitarists, available on the app store.

ScaleViz was developed in Flash CS5 using ActionScript 3.0, which I have been learning since February 2011, AS3 was my quickest route to developing for iOS as I have experience working with timeline animation in Flash and some basic AS2 knowledge, although this didn’t help much as the language has changed significantly from AS2…

I started developing ScaleViz when Adobe first announced their Packager for the iPhone, but at the time I didn’t have an iOS device, then the project was cancelled, and so was ScaleViz, left on the shelf for another year, I did change the development to Flash Lite for a short while but didn’t get very far as device support was dwindling.

Eventually I got myself an iPod (Gen 2) and it absolutely blew me away, I could actually see ScaleViz working with swipes and my enthusiasm was reborn, within the next few days I joined the Apple Developer Program and guess what I did first, that’s right, the cobwebs were blown away, and ScaleViz was compiled, needless to say it didn’t work, it was all timeline and AS2 based. but, that’s how my AS3 journey started…

I will be posting some code snippets, hints and tips, tutorials and general advice covering subjects that I learned while developing ScaleViz, topics include, Developing mobile Apps with Flash CS5 using ActionScript 3.0, and Web Apps with Dreamweaver and jQuery-mobile, and I’m sure Photoshop will make an appearance somewhere, plus you can check out my past and present projects. So, thanks for looking, enjoy your stay and I hope you find something useful.

Note the AS3.0 code sample’s are the same for all devices, the publish setting you choose when you compile your app, sets the target device.

For targeting Android devices you need to use, Flash CS5.5 using “Air for Android” as the publish setting (The Flash CS5.0 Air for Android Extension is no longer available).

For publishing to an iOS device, you need Flash CS5.0 with the “Flash Professional CS5.0 Update for iOS”, which you can find at Adobe’s Flash Support Center, or you can use Flash CS5.5. You also need to be a registered Apple Developer.

Note: If your not running the Mac version of Flash for iOS development you should have access to a Mac to create your .p12 certificate, and upload your binaries for review.

Subscribe for FREE to access Code Samples

Jan

25

Posted by : admin | On : January 25, 2012

The new Mac mini

Up to 2x faster processors and graphics.
High-speed Thunderbolt I/O. It’s mini in size only.

Now Features OS X Lion.

Being a long time Windows user I’ve been pondering on the idea of getting a Mac for a while now, and considering I’ve been a registered Apple Developer for nearly a year now, I thought it was about time to take the plunge, and I’m so glad I did, after playing around with Mission Control and finding out all the keyboard shortcuts, I thought to myself, I should have got one of these a long time ago, being able to have multiple desktops is an awesome feature and is probably my favourite so far.

I was also very pleased when I logged into the Mac App Store, which comes pre installed with OS X Lion as I found Garage Band, iPhoto & iMovie, the three Apps from Apple that make up the iLife suite, sitting there waiting for me to accept as a freebie, sweet, thanks Apple.

xCode4.2.1 is installed along with Cocos2d and I’m looking forward to adding Objective C to my collection of programming languages and getting stuck in to some coding.

xCode 4.2.1 targeting an older armv6 device

One problem I came across is that the new xCode (4.2.1), does not support older devices (armv6) out of the box, I have a second Gen 8GB iPod Touch, and when I tried to build directly to my device, xCode would say finished running app on target device but nothing would happen.

After a bit of searching I found the answer from MattyG! over at stackoverflow.

The solution as mentioned in the link above is to add the armv6 architecture to your build settings, by double clicking on standard armv7, clicking the +, then typing in armv6, once you have done this make sure you delete armv7 from the ‘Required device capabilities’.

Your app should now compile and run fine on an older arm6 device, if not check your projects deployment target and drop it down to 4.2, and you should be good to go.

Jan

25

Posted by : admin | On : January 25, 2012

I found these links a few weeks ago and wish I had found them a lot earlier, some really good sample code across categories that include interactivity, transition effects, image loading, masking and even some sample games.

Here’s what it says on Adobes sample page

One of the quickest ways to learn Flash Professional is to look at existing sample files to see how they are built. This page contains links to several Flash samples, with instructions on how to use them.

Here’s the link to the AS3.0 samples page on Adobe’s site.

Jan

25

Posted by : admin | On : January 25, 2012

Check out this awesome Mobile AS3 Basics course from Cartoon Smart

There is Tons of ActionScript 3 For You To Begin Creating Apps for Mobile Devices like the Android or iPhone.

Course Topics: Accelerometer

The adventure begins here. We’ll take a look at using Flash CS5, Actionscript 3 and Device Central to test an application that uses your device’s accelerometer to roll a marble around. The virtual phone in Device Central can also be used to test with (Device Central is included with Flash CS5 )

After the accelerometer code is in place, we’ll make the project a bit more interesting and add some collision detection and a timer to reset the board.

Multi-touch Input

This course takes a look at the various ways of adding touch input to your Flash CS5 app or swf. Touch-enabled devices that are running Flash Player 10.1 or higher can make use of this functionality, so you don’t necessarily have to be exporting your Flash project to an application. This code could be used for a Flash movie played within the browser.

We’ll look at detecting states like: touch begin, move, end, rollover, rollout, as well multiple touches, pressure, the size of the area you are touching, your primary touch target, and much more.

Gestures

This part teaches how to add Gesture recognition to your Flash CS5 project. Gestures are finger actions like pinching, swiping, panning , rotating, two finger tapping or long-pressing. Example files are created for each gesture and we’ll look at some of the pro and cons to using Gestures vs Touch Input.

Google Maps and Geolocation

This tutorial goes over downloading and installing the Google Maps Component for Flash (which can be used for your mobile or non-mobile Flash projects). We’ll look at plugging in a latitude and longitude and adding the zoom and map view types to your Flash Google Map.

Finally we’ll check out the Actionscript 3 used for detecting the geolocation of your device (the latitude and longitude) and plugging that into the Google Map.

CameraRoll

Yes thats a screenshot of a zombie-style dress-up game. Why not right. So in this tutorial you’ll see how to save an image from your Flash movie to your device’s camera roll (or media gallery). This has been successfullly iPhone and Android tested. You can save either the entire stage, portion of it, or specific movieclips. This little bit of code could be the foundation of MANY kid’s apps.

Also we’ll look at how to pull in an image from the camera roll to your Flash movie (successfully tested on the Android butthe iPhone doesn’t want to make this happen yet)

Orientation

We’ll take a quick look at the Actionscript 3 code to detect a change in orientation on your device, then optionally change the appearance of your objects on stage (or do anything else).

Exporting an iPhone App

This lesson will teach you how to export your Flash CS5-created iPhone or iPad and install it on your device. You will need to sign up for Apple Developer program to fully test your app (and eventually to submit it to the Store)

Exporting an Android App

This two video course goes over testing your AIR to Android app on either a device (in my case the Samsung Galaxy Tab) or using the emulator from the free Android SDK.

Jan

17

Posted by : admin | On : January 17, 2012

The sample code in this tutorial shows you how to simulate swipes to accelerate your mobile development. It sounds complicated but in reality is as simple as duplicating your swipe code so that it works with either button or keyboard presses, the arrow keys are the perfect candidate.

The swipe code in ScaleViz is quite complex and this technique has saved me lots of time and headaches, so I thought I would share it with you, I’m using the test app from our last tutorial.

As mentioned above all we need to do is simulate our swipes with the arrow keys, there are many different ways you can do the same thing in AS3, here I have chosen to use a case statement, which takes a value passed to it through a function from an event listener and compares it with the conditionals inside the case statement.

To add this function to our test app we first add an event listener to the stage, which listens for a keyboard press and then passes the pressed key to the function called “swipeSimHandler”:

stage.addEventListener(KeyboardEvent.KEY_DOWN, swipeSimHandler);

Then we add the handler function that receives the pressed key from the above listener and passes it to the case statement inside the handler, which then does something depending on which key was pressed, in this case I have added in a trace statement that writes out which arrow key was pressed to your output window.

A trace statement is an awesome feature of AS3 that you can use to write out the value of variables and messages to your output window so you know that your code is working.

If your output window is not open then press F2 or go to “Window – output”, although it will usually open itself if there’s a message to show you.

Here is our skeleton case statement.

function swipeSimHandler(event:KeyboardEvent):void
{
switch( event.keyCode )
{
case Keyboard.RIGHT:
trace(“Right Arrow Key Pressed!”)
break;

case Keyboard.LEFT:
trace(“Left Arrow Key Pressed!”)
break;

case Keyboard.UP:
trace(“Up Arrow Key Pressed!”)
break;

case Keyboard.DOWN:
trace(“Down Arrow Key Pressed!”)
break;
}
}

Note: We can listen for any keys, they don’t necessarily have to be the arrow keys.

For example: We could change the above case statement from Keyboard.Right, Keyboard.LEFT,  Keyboard.UP and Keyboard.DOWN to keyboard.R, keyboard.L, keyboard.U and keyboard.D , this would control our swipe code with the R, L, U and D keys, you can find the other key codes in Flash’s help, just highlight the word keyboard and press F1 while in your actions panel (F9), this will show you which other keys are available.

Now all we need to do is copy our current swipe code and paste it into the correct place within the case statement, remembering that the swipes will be reversed on a Mobile device so we need to swap them round again. So, we paste the conditional statement from the right swipe into the keyboard left conditional and the left swipe into the keyboard right conditional, see previous tutorial for details.

Here’s our new swipe code with the added code in bold:

function swipeSimHandler(event:KeyboardEvent):void
{
switch( event.keyCode )
{
case Keyboard.RIGHT:
trace(“Right Arrow Key Pressed =, Simulate Swipe Left!”)
if(currentFrame == totalFrames)
{
gotoAndStop(1);
}
else
{
nextFrame();
}
break;

case Keyboard.LEFT:
trace(“Left Arrow Key Pressed – Simulate Swipe Right!”)
if(currentFrame == 1)
{
gotoAndStop(totalFrames);
}
else
{
prevFrame();
}
break;

case Keyboard.UP:
trace(“Up Arrow Key Pressed!”)
gotoAndStop(1);
break;

case Keyboard.DOWN:
trace(“Down Arrow Key Pressed!”)
gotoAndStop(3);
break;

case Keyboard.V:
showTxt();
break;
}
}

We could also add another conditional inside the case statement, which as you can see I have done above, this adds a listener for the letter V which runs the function “showTxt”, when the “V” key is pressed, which toggles the visibility of text “ScaleViz Rocks!” to either on or off, so not only can you use this technique for simulating your swipes you can also use it to add in keys to work various parts of your app that could rely on the swipes performing a certain function.

You can now run your test app within flash using the arrow keys to simulate your swipes and you know that when you are ready to deploy your app for testing on your device everything will work as you expected, just remember to swap the left and right code back again.

As you can see this is a massive time saver when your app relies on swipes as you don’t have to keep deploying it to your device to test if your latest code change is working as it should.

Download Sample Code
(To access code samples, Subscribe for FREE using the form on the home page or in the side bar. Tutorial files were created using Flash CS5 Professional version 11.0.2.489));

Contents of Archive (2 Files)
simulateSwipe.fla (fully commented test app)
simulateSwipe.txt (info)

Jan

16

Posted by : admin | On : January 16, 2012

In this tutorial we modify our swipe code so that, a left swipe on our last frame will loop to the first frame and a right swipe on our first frame will loop to the last frame.

I’m using the hideLogo_completeC.fla file from the previous tutorial sample files and have added a conditional statement inside our swipe code, in which we use the “currentFrame” and “totalFrames” properties to loop through the frames.

Note: Directions are reversed on a mobile device, so a swipe left would go to the next page and a swipe right would go to the previous page.

I have added the following conditional statement to our swipe right code.

if(currentFrame == 1)
{
gotoAndStop(totalFrames);
}
else
{
prevFrame();
}

Above we are asking Flash to check if the play head is on the first frame, if so, then move the play head to the very last frame, otherwise move to the previous frame.”

Here’s the code snippet for swipe left:

if(currentFrame == totalFrames)
{
gotoAndStop(1);
}
else
{
nextFrame();
}

Here we are asking flash to check if the play head is on the last frame, if so then go to the first frame, otherwise go to the next frame.

Note: Because we used the “currentFrame” and “totalFrames” properties, and not specific frame numbers, we can add as many frames as we like to our test app, and the code will always work, check out the sample code for more info.

Download Sample Code
(To access code samples, Subscribe for FREE using the form on the home page or in the side bar. Tutorial files were created using Flash CS5 Professional version 11.0.2.489));

Contents of Archive (2 Files)
loopFramesC.fla (fully commented test app)
loopFrames.txt (info)