Hide Old and Reveal New Script
Posted by Helmut Granda | Filed under ActionScript, Programming
I was talking the other day with a friend about a small challenge, having 2 images on stage with 2 ideas. 1- have the experience being user driven (in this case the mouse reveals one image while hiding the other) 2- Use XML for easy update. So we fired flash and the above is the visual and the code below... Read the rest of this entry »
//Compile to Flash 8 when using EventDispatcher
Posted by Helmut Granda | Filed under ActionScript, Programming
or a while I was not able to fire different events and the reason why is because I was compiling to flash player 9 instead of 8. So if there are certain events that are not firing one thing that you can check is the export settings.
//Creating empty movieclips – not on the fly
Posted by Helmut Granda | Filed under ActionScript, Programming
hen you need a visible movieclip instead of creating a movieclip on stage and cleaning it up create a moviclip directly on the Library -New Graphic-.
//Movieclip Instance Name to String
Posted by Helmut Granda | Filed under ActionScript, Programming
When Dealing with Movieclips and you need to access the refence as string do [instanceName].toString() rather than instanceName.toString()
//Always do a garbage collection
Posted by Helmut Granda | Filed under ActionScript, Programming
As simple as creating a method in your class or a function on your code to delete unnecessary variables or set them to null for garbage collection.
//Flash PHP mySQL – Write to a Database with Flash and PHP
Posted by Helmut Granda | Filed under ActionScript, PHP, Programming
I have written a small script that will assist you into using communication between Flash and PHP to write to a mySQL database. The task is simple, verify the contents of the fields in flash and then send the information to PHP who then writes the information into the database. Read the rest of this entry »
//Flash Volume Controler ActionScript 2
Posted by Helmut Granda | Filed under ActionScript, Programming
I had a good friend ask me if I knew of a resource for a volume controler, and I didn't know of any tutorial or code of the top of my head so I went ahead and wrote it for AS2 so I hope this can help some others out there. Read the rest of this entry »
//Actionscript count and trace the number or arguments passed to a function
Posted by Helmut Granda | Filed under ActionScript, Programming
-
var totalArgs = arguments.length;
trace("Number of Arguments passed = " + totalArgs);
for (var i:Number = 0; i < totalArgs; i++) {
trace ("Argument "+i + ": " + arguments[i]);
}
Actionscript Round and keep decimals function
Posted by Helmut Granda | Filed under ActionScript, Math, Programming
- function formatDecimals2 (num, digits) {
if (num < 0 ) {
num = 0;
}
if (digits <= 0) {
return Math.round(num);
}
var tenToPower = Math.pow(10, digits);
var cropped = String(Math.round(num * tenToPower) / tenToPower);
trace("digits:" + digits + " - " + cropped);
}
formatDecimals2( 35435.234234, 2);
formatDecimals2( 35435.234234, 3);
formatDecimals2( 35435.234234, 4);
Set a footer on your Flash Movie
Posted by Helmut Granda | Filed under ActionScript, Programming
- stageListener = new Object();
stageListener.onResize = function() {
// enter what you want to do on resize, for example:
contentHolder_mc._y = Stage.height - contentHolder_mc._height;
contentHolder_mc._width = Stage.width;
}
Stage.addListener(stageListener);
stageListener.onResize();