Archive for the ‘ FLASH ’ Category

Load Drupal view with Flash and AMFPHP

I recently have been getting into Drupal at work and one of the things we were needing to do was get information out of our Drupal cms install to use in Flash. One method for doing this is to use the NetConnection class in Flash for which I have the code available to download below. In order to do this, setup your Drupal install with the proper modules and permissions.

1. Download and enable a few modules in Drupal.
* AmfPHP
* Services (enable views service)
2. Create a view with the info you want to show in flash
3. Set the proper permissions on your views. (Described in the modules’ documentation)
4. Download my code below, putting in the path to your amfphp install as well as the name of the view you created in step 2.

Note: I had to downgrade to php 5.2.13 in my MAMP install because I was getting the “Function ereg() is deprecated” error but this can be fixed as described in the post if you want to use PHP 5.3+

I am hoping that someone will make a zendamf module since amfphp is not being actively improved.

  NetConnection.zip (24.4 KiB, 124 hits)

Load XML with LoaderMax

I did have my own set of classes that I use for loading files(images/xml etc) but since I use Greensock for tweening I figured I should use it for loading my assets as well.

//import the classes, u dont need easing for this but you should be using it
import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.events.LoaderEvent;
import com.greensock.loading.*;
 
//above your class constructor function
private var _loaderMax:LoaderMax;
private var _xml:XML;	
 
//in your code where you want to use it
private function loadXML():void {
_loaderMax = new LoaderMax({name:"mainQueue", onComplete:completeHandler, onError:errorHandler});
_loaderMax.append( new XMLLoader("yourFile.xml", {name:"xmlDoc"}) );
_loaderMax.load();
}
 
private function completeHandler(event:LoaderEvent):void {
_xml = LoaderMax.getContent("xmlDoc");
}
 
private function errorHandler(event:LoaderEvent):void {
	trace("error occured with " + event.target + ": " + event.text);
}

Save in Flash Builder causes Flash to Publish

If you are coding your Flash project in Flash Builder, this can be very annoying. To make sure this does not occur, go into your Flash Builder 4 Preferences, select General, then Workspace, and then uncheck Build Automatically.

HTTPService and ArrayCollection in Flash CS4

Recently I had a need to use the HTTPService & ArrayCollection Flex classes from inside Flash CS4. In order to do this you need to point to the Flex classes in your Flash preferences as outlined in this post. Code after the jump. Read more

FlashTracer and Windows 7

I recently upgraded from XP to Windows 7 and have had to re-install a few things so I figured I would post the instructions as I set them up. This is about setting up the extremely very valuable tool for every Flash developer that is Flash Tracer. But it CAN be a pain to setup with multiple versions scattered around the web, various instructions on different blogs, and quite often important tips buried in the comments of said blogs. Hopefully this can help you setup Flash Tracer without a lot of effort.

I am using Firefox 3.5.5, on Windows 7, with the Flash Player 10,0,32,18 debug installed.

Read more

Location of WindowSWF folder in Windows 7

I recently upgraded from XP to Windows 7 and needed to re-install some plugins for Flash CS4 and had a bit of difficulty finding this folder.

1
C:\Users\jguthrie\AppData\Local\Adobe\Flash CS4\en\Configuration\WindowSWF

Flex and Flash with Zend

In order for this tutorial to work, you need to make sure that your environment is setup by following the instructions located here. I have included an fla (cs3) file in the /Flash folder of the Flex project archive. You would not normally do this for a production project but this is just meant to be a simple example and since they both use the same php files it didnt make much sense to split this article up into two separate articles.

I am currently using Flex Builder 3.0.2 and Flash CS4 but I saved the fla as a cs3 file for those that don’t have it yet.

Code and instructions after the jump Read more

Natural Docs with Flash

Natural Docs is a great way to generate professional, inter-linked documentation on your code.  While it took me a bit of effort to set it up, there isn’t actually anything that is ‘installed’; you simply need to put  files in the right directories and point them to each other.  Hopefully this saves you some time. Read more

Full Browser Flash Website

I was looking through my Flash files the other day and found this. It is a full page flash website, meaning that the flash fills the entire page regardless of the size of the user’s browser. It is written in AS2 and isnt coded the best as I wrote it awhile ago but is a great introduction to using tween classes. (This one uses MC Tween).

Demo

  Full browser flash website in as2 (5.5 MiB, 1,060 hits)

MovieClipLoaderClass – AS2

I have been reading a lot of questions about how to properly load movies in projects using actionscript2. This is how I do it:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    var my_mcl:MovieClipLoader = new MovieClipLoader(); //Used to load the image
 
    button1_mc.onPress = function() {
    my_mcl.loadClip(movie1.swf, container_mc); //loading a movie into a container movie clip (just an empty mc on the stage)
    };
 
    button2_mc.onPress = function() {
    my_mcl.loadClip(movie2.swf, container_mc); //loading a movie into a container movie clip (just an empty mc on the stage)
    };
 
    var mclListener:Object = new Object();
    my_mcl.addListener(mclListener);
 
    //the three listeners below are optional
    mclListener.onLoadStart = function(container_mc:MovieClip) {
    //The listener tells this function that downloading the image has begun and to perform whatever code you put here
    };
    mclListener.onLoadError = function(container_mc:MovieClip, errorCode:String, httpStatus:Number) {
    // this function fires if there is an error in loading the movie
    trace(”loadListener.onLoadError());
    trace(”==========================”);
    trace(”errorCode: ” + errorCode);
    trace(”httpStatus: ” + httpStatus);
    }
    mclListener.onLoadComplete = function(container_mc:MovieClip) {
    //The listener tells this function that downloading the image has completed and to play whatever code is here
    }
 

Switch to our mobile site