• Click to Go to Web Page

    Making an object go to a web page when clicked, pressed or touched is fairly straight forward, in this “Code Snippet Example Tutorial” we are going to be working with the same test app as in the previous tutorial, however, this time we call the “showTxt()” function with no parameters, use the “Click Me!”, button to load a Web Page, add a Mouse Listener to a MovieClip with an instance name of “tutorialTxt” to make it clickable and point both the button and the MovieClip Listeners to the same function. Check the code comments in the tutorial files for more details.

    Note: Flash will automatically convert clicks to touches when you compile your app.

    You must be a registered Apple Developer to build your app for iOS device testing.

    To make an object go to a Web Page the target object must be a MovieClip and it must have an instance name, in fact anything you want to control with ActionScript must have an instance name, so you can target the object specifically.

    Note: I have set the objects button mode (which in this case is a “MovieClip” that contains some text, with an instance name of “tutorialTxt”), to true, this assigns the hand cursor when you mouse over the object, “Button Mode” is irrelevant on an iOS or other mobile device.

    Here’s the code to use to make a click, press or a touch go to a webpage:

    // add event to listen for mouse click
    tutorialTxt.addEventListener(MouseEvent.CLICK, goToWebPage);

    // enable hand cursor
    tutorialTxt.buttonMode = true;

    // function to handle the button click
    function goToWebPage(event:MouseEvent):void
    navigateToURL(new URLRequest(“http://www.scaleviz.co.uk”), “_blank”);

    Note: You can also use the code snippets panel to add this code automatically, just select an object on the stage, open the code snippets panel by going to “Window – Code Snippets”, open up the “Actions Folder” and double click the “Click to Go to Web Page” Snippet, Flash will do the rest for you.

    If your object is not already a MovieClip, Flash will convert it for you and give your object an instance name, although I recommend that you perform these steps yourself, this way you can give your objects meaningful names that actually represent what the object is, or does instead of using the automatically generated names which will be in the following form, Symbol 1 for the movieClip and movieClip_1 for the instance name, taking this step will make your code a lot easier to manage later on.

    If your object is already a movieClip and but doesn’t have an instance name, Flash will generate an instance name for you.

    To convert an object to a movieClip, select it and press F8, make sure the type is set to movieClip and not, Graphic or Button, set the registration point (used for alignment), then give your new symbol a name. The Symbol name is for your reference and doesn’t have to be the same as the instance name, so you can call it whatever you like, just remember to use a descriptive name.

    The Symbol name you chose will be displayed in the Library, next to the Symbol.

    To give your new symbol an instance name select it on the stage, then type the name into the properties panel, if the properties panel is not visible press “Ctrl+F3” on a PC or “Cmd+F3” on a Mac, or select it from “Window – Properties”, the instance name is usually written with all words but the first capitalized, if you like you can also add a suffix to describe the object ( Txt, Btn, MC, etc), but this is not necessary.

    Once you have created your MovieClip and set the instance name, you can use the code snippets panel to add the “Click to go to Web Page” Code Snippet (as directed above), and flash will use the descriptive names that you have chosen for your objects in the code it creates for the Snippet.

    To access code samples, Click Here.
    Tutorial files were created using Flash CS5 Professional version

    Contents of Archive (3 Files)
    clicktogotowebpage.fla: non commented version.
    clicktogotowebpageC.fla: commented version.
    // ====================================
    // AS3 Click to Go to Web Page tutorial
    // Downloaded from http://mds.scaleviz.com
    // Copyright © 2011 Shane Hogan
    // Developer of ScaleViz – A Theory App Designed for Guitarists.
    // http://www.scaleviz.com
    // Coded in Flash with ActionScript 3.0
    // =====================================

    In this “Code Snippet Example Tutorial”, I teach you how to use the “Go to Web Page Code Snippet”.

    Also, if you Study the code comments, you can find out how to;
    call a function with no parameters.
    Use a button to load a Web Page.
    Make a MovieClip clickable.
    Point multiple Listeners to the same function.

    Note: You will find two versions of each file in the archive
    the file that has a “C” on the end is fully commented.

    Copyright © Shane Hogan
    Do not copy this article.

  • ArgumentError: Error #1063

    ArgumentError: Error #1063: Argument count mismatch on error_1063_fla::MainTimeline/showTxt(). Expected 0, got 1.

    Whilst developing your app you may come across this error, the app will compile fine but as soon as you go to press the button “Click Me”, Flash will give you the error code shown above.

    OK, for this tutorial I have put together an AS3 document at 320 x 480 pixels, it contains a button, which I dragged in from the components pallet (Ctrl+F7 on a PC, or Cmd+F7 on a mac, or you can choose “Window – Components” ), and set the button label under the “Component Parameters” in the properties panel to  Click Me, I then dragged out a dynamic text field and set the instance name to “outputTxt”, added some background graphics and we have our test app.

    Note: everything is on it’s own layer, which is good practice and makes the file easier to edit, also when you start animating, the object you’re animating needs to be on it’s own layer.

    When you press the “”Click Me” button the dynamic text field should show, “ScaleViz Rocks!”.

    So, whats this all about then, well this one is a simple fix, Flash is telling you that the event listener for the button doesn’t match the event handler in the function, all you need to do is add the correct event to the event handler for the function, and the code will work.

    Here’s the non-working code:

    import flash.events.MouseEvent;

    clickBtn.addEventListener(MouseEvent.CLICK, showTxt);

    function showTxt(): void {
    outputTxt.text = “ScaleViz Rocks!”;

    Here’s the fixed code with the correct event assigned to the event handler, the added code is in bold:

    import flash.events.MouseEvent;

    clickBtn.addEventListener(MouseEvent.CLICK, showTxt);

    function showTxt(e:MouseEvent): void {
    outputTxt.text = “ScaleViz Rocks!”;

    This may seem like an easy mistake to make but if you are just beginning and have lots of different functions, handlers and listeners it is quite easy to overlook, and errors of any kind can be a bit overwhelming at first, however, as you can see it is easily fixed.

    To access code samples, Click Here.
    Tutorial files were created using Flash CS5 Professional version

    Contents of Archive (5 Files)
    error_1063.fla: non commented version showing fixed code.
    error_1063C.fla: commented version showing fixed code.
    error_1063_Wrong.fla: non commented version showing wrong code.
    error_1063_WrongC.fla: commented version showing wrong code.
    // ====================================
    // AS3 fix error # 1063 tutorial
    // Downloaded from http://mds.scaleviz.com
    // Copyright © 2011 Shane Hogan
    // Developer of ScaleViz – A Theory App Designed for Guitarists.
    // http://www.scaleviz.com
    // Coded in Flash with ActionScript 3.0
    // =====================================

    ArgumentError: Error #1063: Argument count mismatch on error_1063_WrongC_fla::MainTimeline/showTxt(). Expected 0, got 1.

    Note: You will find two versions of each file in the archive.
    The file that has a “C” on the end is fully commented,
    the other file, is the code with no comments.
    The file with the suffix _Wrong has the code that will
    generate the error.

    The best way to learn AS3 is to dive in at the deep end.
    The comments I have written in the .fla files will help you
    decipher what’s going on in the code, once you grasp
    the concept of event handlers and listeners, you will
    be well on your way to creating your first App.

    Copyright © Shane Hogan
    Do not copy this article.

  • Setting up a Chroma Key Green Screen

    I am currently setting up a Chroma Key Green Screen in my office for future projects, and having looked around at all the various options, I thought that I would share with you the cheapest way to accomplish a fairly good approach to achieving this.

    eBay is your friend when it comes to buying stuff for cheap, because there are lots of sellers all offering the same items and they are all competing for each others business, although when you do find the item your looking for on eBay it is always worth checking Amazon to see if they have the item cheaper, just keep in mind that post & packing on Amazon it is often not listed and you could end up paying more if you purchase from a private seller. I ended up getting all the equipment I needed from eBay UK for £82.72 including all the lighting.

    My first purchase was a 45w (equivalent to 225w) Photography Daylight Light Bulb with a 5500K (full spectrum – Noon daylight) B22 (Bayonet fitting), at a cost of £8.49 + £2.89 p&p from seller “green-lamp-ltd“, this was for general lighting as anyone who has tried to film in HD under standard lighting will know that conventional light bulbs just can’t cut it as they produce too much noise and your videos can come out very grainy, also this time of year you can’t rely on the good old English weather and I consider myself lucky if the sun is in the right position to give me enough daylight to film for an hour, and that is no where near enough time, generally I’m just getting into my stride and the light fades.

    These bulbs are also good for SAD (seasonal Affective Disorder), and I can see why, because as soon as I switched it on I felt myself smiling, it’s just like having your own personal sun at your command whenever you need it, they give off an amazingly pure brilliant bright white light, and as a bonus they also save money on your electricity bill.

    Next the actual green screen itself, this was  purchased from seller “emilyandlily”, at a cost of £14.21 + 99p p&p, and for this you get a 6 X 9ft Chromakey Green Muslin Backdrop, made from very good quality material, that has the edges all stitched nicely, this was the perfect size for my needs but just in case you need to cover a larger wall, the same seller also offers a 10 x 20ft version for £35.51, which is a bargain compared to some of the other sellers.

    To stick it on the wall, you can either purchase a curtain pole, handy if you are planning to do some standard filming as you can easily fold it up so it’s out of the way when not needed or, if it’s going to be a permanent fixture you can grab some green push pins, I chose the latter option and bought them from seller “squidley_filbert”, at a cost of £1.05 + 65p p&p for 50, 2 lots of these should do the trick, luckily the wall that I have chosen is an internal wall and is made of plasterboard, perfect.

    Now, because you don’t want to cast any shadows onto your green screen you need to light it up, so my next purchase was 2 adjustable extending wall work lamps, purchased from seller “a1baron”, at a very reasonable price of £24.99 + 4.99 p&p, they take ES E27 bulbs and are rated at 60w, add to these some 45w (225w equivalent) Photography Daylight bulbs with a 5500K full spectrum and an E27 fitting, which I also purchased from the same seller I got my first bulb from and job done.

    Also as these lamps are extending I plan on screwing them to the wall so they can be fully extended so they just reach the green screen wall, this way I can also use them for extra lighting for standard filming.

    So that’s it my green screen equipment is all ready to go on my office back wall.

    Here’s the list of material’s purchased:

    Lamps from from eBay Member ID “a1baron”
    2 grey adjustable extending wall mounted extending work lamps
    Cost: £29.98 inc p&p

    Green push pins from eBay Member ID “squidley_filbert”
    100 Green Push Pins for cork notice boards
    Cost: £3.40 inc p&p

    Green Screen from eBay Member ID “emilyandlily”
    6 X 9ft Chromakey Green Muslin Backdrop
    Cost: £15.20 inc p&p

    Bulbs from eBay Member ID “green-lamp-ltd
    1 x 45w => 225w Photography Daylight 5500K B22 Light Bulb
    2 x 45w => 225w Photography Daylight 5500K E27 light bulb
    Cost: £34.14  inc p&p

    Total Cost: £82.72

  • Mindplace Light and Sound Meditation Machines – The Procyon

    The Procyon is an Audio-Visual Synthesizer made by a company called MindPlace, this is an awesome device that allows tranquility and profound states of focus and calm, from the first moment you ‘plug-in’, you’ll synchronize your consciousness to heightened states. Light and Sound Technology makes the experience of Zen-like mindfulness and inner peace possible, and can break habitual undesired states like anger and restlessness. A session on what are also known as mind machines will settle and compose your mind as well as enhance your mood.

    To find out more about Mind Machines visit MindPlace, these devices are the ultimate toy for the tech who has everything, and I can personally recommend the Procyon which I use for accelerated learning (Sessions 2-4), Creative Visualization (Sessions 40-45), or for just chilling, if you prefer you can just sit back and watch the light show, which when mixed with your favorite CD-quality digital audio tracks from your home stereo, computer, mp3 player, or smartphone, you have the perfect psychedelic symphony for a fantastical journey to the deepest reaches of the mind and beyond.

    Mind Meditation Machines from MindPlace come in three different configurations called, Kasina, Proteus, and Procyon.


    I am currently working on some screencasts for the digital version of Audio Strobe called SynchroMuse (dAS), you can find the tutorial videos here, note this is an on-going project and as such video content is subject to change, I should also point out there is no need to program these devices for standard usage, just plug in and play one of the fifty meticulously-crafted sessions, which showcase the vast capabilities of the system and are all build upon scientific studies to deliver tracks that entertain and sync your consciousness to the highest levels of human awareness.

    While we’re on the subject of the mind, I have to mention, Dr. Jonathan Royle, who provides expert training in all things hypnotic, and NLPPA approved Neuro Linguistic Programming courses, and who’s seminars and training courses I can also personally recommend, having attended at least three so far, one of which was called “There’s no Such Thing as Hypnosis”,  which is a very informative, entertaining and mind expanding course, for more information visit hypnotherapycourse.net