Hex To Rgb Color Codes
I am applying some styles to a flash input field.
_root.textField.border = true; _root.textField.borderColor = 235235235;
I was wondering how to get this code to accept an rgb color code instead of hexadecimal code.
Any help is always appreciated, thanks in advance.
FlashKit > Flash Help > Flash ActionScript
Posted on: 03-23-2004, 05:17 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
External Color Codes
Hi All !,
I have made a simple flash site
http://www.intellicomdevelopment.com/blue/index.html
Now I want to change the main colors of it that are blue and grey using external text file.
Please tell me how can I do it?
Thanx in advance..
Question Re: Color Codes/Component Style Declaration
I am not understanding the use of hexidecimal color codes for component styles. What is the "0x" for? This is not addressed in flash help. What I am trying to figure out is if I can specify alpha transparency with style declaration and I'm wondering if the seemingly superfluous prefix may have something to do with it. Either way I'd at least like to know what it means.
Thanks in advance,
JeevesQuimby
Music Codes, Youtube Codes In Flash Site
is it possible to make music codes when typed into an input field and then submitted using a button movie clip, work in a flash site? I mean the same way how they work on myspace, etc. Youtube codes too. If anyone knows how to do so, please help me to the information. Thank you very much.
Codes...
alright i need something explained to me.
onClipEvent (enterFrame) {
this._x += ((_root._xmouse+30)-this._x)/2;
this._y += ((_root._ymouse+5)-this._y)/2;
what to each line stand for and tell the movie to do
do each line have the same type of coding for other scripts?
the first line tells when i know that
but second and third???
and one more thing.
can you explain to me how to come up with your own code and how to type it if you get it....
may be a bit vague but im still figuring this stuff out
-largefry
MX Codes Help
I have spent the last four days trying to get these codes to work. They are mc's the hold buttons-instructions say all codes must go on ther main time line. I have five pages of codes I have tried to get the rewind-pause and forward to end buttons to work. can any one help me--I must use MX codes only for this Senior year project
startTime = 0;
pause_mc.onPress = function()
{
mySound.stop();
};
pause_mc.onRelease = function(){
mySound.start.position;
};
//---------------------------------------------------
forward_mc.onPress = function()
{
if(mySound.position >(mySound.duration - 0.3))
{
mySound.position = 0;
mySound.onLoad(mySound.position);
mySound.start();
}
};
//----------------------------------------------
loop_mc.onPress = function()
{
if(mySound.position == mySound.duration){
mySound.onSoundComplete = function()
{
this.gotoAndPlay(1);
mySound.start();
};
}
};
Codes
I'm glad there's no question stupid enough to ask here, because this is probably a really stupid one. I see all these codes around the board, maybe 'actionscripts' is what to call them. But i don't know where these codes go, or how to use them really. Could someone explain?
Here's the kinda thing i'm talking about (ripped from some other topic)
totalBytes = this.getBytesTotal();
loadedBytes = this.getBytesLoaded();
remainingBytes = totalBytes-loadedBytes;
percentDone = int((loadedBytes/totalBytes)*100);
bar.gotoAndStop(percentDone);
if (_framesloaded == _totalframes) {
nextScene();
}
that's pretty confusing to me. I just don't know where to put it. Not that i need this specific code.
I'm using flash 4 by the way
Bug In Codes
I have been working on this little program (with help) that is suppose to randomly load and refresh a image to a specfic location on the screen (x=147, y=240.5). The code work great expect the first image is loaded to a default location on the screen (I think it is x=40,y=40) then it relocate the image to the specfic location and starts the random section.
I have not been able to figure out what is making this happen. Can someone look at it for me and tell me what they think? Here are the codes.
//
//.................[SET UP THE RANDOM NUMBER]...................
totalPhotos = 10; //assuming you have 10 photos - images must be
// in the same dir as the .fla
//.................[CREATE A PLACEHOLDER].......................
createEmptyMovieClip("pictureHolder",10); //create a placeholder
//
//.................[SET UP A PRELOADING FUNCTION]........................
function preloadImages(){
if (pictureHolder.getBytesLoaded()>= pictureHolder.getBytesTotal()){
pictureHolder._x = 147;
pictureHolder._y = 240.5;
pictureHolder._width = 100;
pictureHolder._height = 135; //pictureHolder._width
clearInterval(preloadInt);
}
}
//
//.................[SET UP AN IMAGE SWAPPING FUNCTION]........................
function swapImages(){
whichPhoto = Math.floor(Math.random() * totalPhotos); //get a random photo
pictureHolder.loadMovie("img_" + whichPhoto + ".jpg");
preloadInt = setInterval(preloadImages,1000); //check load once per second
}
//.................[SET TIME INTERVAL]..........................
imageRotationInt = setInterval(swapImages,4000); //load new image once every 3 second
Key Codes
my flash help-site (F1) don't work, so I can't see the key codes... would someone please paste them here ? or better... send the help file to tjaife@hotmail.com...
[CS3] Zip Codes
I need a list of zip codes, if not location ID. Where can i get it from? I am still googling it. If i stumble upon the right one, i will post it here. Meanwhile, anyone here who can help me out with this?
I am trying to gather weather report from all across the globe and display it in my flash page. Right now I have gathered information only for 12 cities, but all these(zip codes) are inserted into array manually, through yahoo weather. Now i am thinking about collecting world weather report and to do this i just need the zip codes of all the places accross the globe. Since this can not be done manually, i am searching for an xml page that has "all" the zip codes.
Codes
HI
Been looking round for a while, but have not found it!!
I am wanting to have a button which lets me go into Outlook explorer.
Say if you were to put 'email' in Dreamweaver and set it to email to a certain address, then view it in IE, th button would open OE with the address at the top.
Now i know it is possible to have this code and function in flash.
Can anyone help me and tell what the code is?
Thanks
Nathan
Codes
I have been making a point and click game where you are stuck in a room. There is a safe you need to open, but you have to drag a pen to the buttons. I have my frame rate at 15 and want the lock to go up or down roughly 4 numbers per second, so i have this:
onEnterFrame = function () {
if (_root.peninventory_mc.hitTest(no1up_mc)) {
safeno1 += .265
}
_root.peninventory_mc is the pen, no1up_mc is one of the buttons and safeno1 is the text.
There are 3 numbers in the code, and i have this:
if (safeno1 == 34 && safeno2 == 15 && safeno3 == 35) {
gotoAndStop(2)
}
}
It puts in the decimals though, so it never gets to that exact number. Eg. 34.02406 etc.
How do i test for decimal aswell without writing every possible combination?
Please help.
Key Codes
I need help with key codes. this is what i got and it dont wrk:
ActionScript Code:
onClipEvent(load) {var key = Key.getCode();}onClipEvent(enterFrame) {if (key == 68) {trace("Problem Fixed");}}
Again Concerning First Codes
//variables
var nSpace = 7;
var xStart = _root._xmouse;
var yStart = _root._ymouse;
var nText = "Kirupa.com";
var nFriction = 3;
//creates the trailer
for (ii = 0; ii < length (nText); ii++) {
//attach Movies from Library
attachMovie ('mcLetter', 'copy' + ii, 100 - ii);
ext = _root['copy' + ii];
//Use substr to call the text from the string
ext.mcText = nText.substr (ii, 1);
}
_root.onEnterFrame = function () {
//For Loop to move the balls
for (ii = 0; ii < length (nText); ii++) {
//Defines ext and prt. Makes Code easier to write.
ext = _root['copy' + ii];
prt = _root['copy' + (ii - 1)];
nDist = Math.abs (prt._y - ext._y);
//checks the extetion _root.copy(ii)
//then tells them what to do.
if (ii == 0) {
//to do Alpha with the first you must target it specifically
//because it does not have a cooresponding PRT MC
ext._alpha = 1000 / (Math.abs (_root._ymouse - ext._y) + 1);
ext._x += (_root._xmouse - ext._x) / nFriction + nSpace;
ext._y += (_root._ymouse - ext._y) / nFriction;
} else {
ext._x += (prt._x - ext._x) / nFriction + nSpace;
ext._y += (prt._y - ext._y) / nFriction;
ext._alpha = 1000 / (nDist + 1);
}
}
};
whats this variable does in this code:
var nSpace = 7;
var nFriction = 3;
Key Codes
I need help with key codes. this is what i got and it dont wrk:
ActionScript Code:
onClipEvent(load) {var key = Key.getCode();}onClipEvent(enterFrame) {if (key == 68) {trace("Problem Fixed");}}
Zip Codes
Would like to know if anyone seen a place where it was explained how to combine a list of zip codes with long/lat in a map of the US using Flash, I have seen one such example
(select zip codes at top of page)
http://acg.media.mit.edu/people/fry
Key Codes
I was wondering if anyone knows the key code for the "print screen key"
I am trying to disable print screen, while a my swf is running as a standalone.
Does anyone know how to disable the printscreen key in the flash player or flash exe. ?
thanks you
Aubrey
Character Codes
Is there anyway you can use flash to detect keys that are down besides the standard home, right, left, end, etc... by using ASCII codes or something? Ty.
Getting Ascii Codes
How do u find the ascii code of a char within a string
Ï'm trying to display text from a text file in a movie. the text file has 3 var in it
delay .........the amount of time each line is displayed
text...........lines of text ending with a return
eof............this is declared false in the script and set to true at thr end of the file.
I'm trying to search for the return(13) at the end of each line so i can break them up in to separate string that will be displayed one at a time
[Edited by johntigner on 03-14-2002 at 12:23 AM]
ASCII Key Codes
look at my ASCII key code creater...
http://www.geocities.com/zosflash/ascii.swf
hope you like it
Range Of ZIP CODES
Hi there,
I have a rang of zip codes where my company can delivery shipments within 24 hours, only in places located in that range of zip codes.
So, based on that information, I´d like to add a search box in the flash movie that I´m working on, this way WE can type the zip code in the search box and press SEARCH. If the user types a zip code that is within that range the actionscript would recognize it and show for example:
"THE ZIP CODE YOU ENTERED IS WITHIN THE 24HS ZONE"
But if the user enters a zip code that is not withing the range codes then show:
"THE ZIP CODE YOU ENTERED IS NOT WITHIN THE 24 HS ZONE"
Example of my range of zip codes:
01000-01099 (any zip code starting in 01000 and ending in 01099)
01500-01599 (any zip code starting in 01500 and ending in 01599)
and so on
Please note that I have more than one range of zip codes.
How do I set my IF actions to work as follow:
if (zipcode >=0100 && zipcode<=01099){
message = "THE ZIP CODE YOU ENTERED IS WITHIN THE 24HS ZONE";
}else if{
and so on
WILL IT WORK??? I HAVE ALREADY TRIED AND IT DIDN´T WORK HERE.
One thing that I don´t understand. What is the difference between = and == ??
In this case, should I use >==???
Codes To Move MC
hi there,
help me
1- to move an object(MC)when click it
2-moving an object(MC) when click a button
thanks
What's Wrong In These Codes?
I meant to build a dot moving with the given coordinates. and I wrote such codes, but the dot just moved once and stopped. I can't figure out what's wrong in it, pls help me!
stop();
_root.createEmptyMovieClip("smp", 1);
smp.attachMovie("dot", "tdot", 2);
xt = new Array(2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9);//xt stores raw data of coordinates.
t = 0;
move = function (xt, t) {
l = xt.length;
if (t<=l) {
_root.smp.tdot._x = xt[t]*20;
t += 1;
} else {
_root.gotoAndStop(1);
}
};
id = setInterval(move(xt, t), 1000/rate);
Appendix B-Key Codes
For everyone that uses keyCodes, this is the file for you! All you have to do is enter, for example, "backspace" and it will tell you what the keyCode for that key is! (in this case, 8). You can also put in a number and it will tell you what key that is for. The file is attached. (If you find any bugs, please tell me)
~MD
MyPetSkeleton Codes
hey does anyone know how they did some of these things on www.mypetskeleton.com
like on the enter page there are diff section to click, the things on those pages
Text Codes
Hi guys
Hope everyone is well, just a simple question I hope.
I’m using a dynamic flash site that uses a html page to insert the text in to my text boxes but I’m stuck on the codes for pacing certain characters.
For example if I want to add a plus sign (+) what code do I use, I’ve just tried placing the sign but it doesn’t show up?
I know the ‘&’ requires a code but would anyone know of a site or the codes.
Hope that makes sense.
Dominant Key Codes
in the game I am building, I keep having trouble with dominant keys. For example,
on the MC on the stage;
onClipEvent(load){
mySpeed = 4;
}
onClipEvent(enterFrame){
if (Key.isDown(Key.LEFT)){
_x -= mySpeed;
}
if (Key.isDown(Key.RIGHT)){
_x += mySpeed;
}
}
a simple speed variable code
and on the inside of that MC on an invisible button;
on (keyPress "<Up>"){
gotoAndPlay("startJ")
}
on (keyPress "<Space>"){
gotoAndPlay("startA")
}
on (keyPress "<Left>"){
gotoAndPlay("startL")
}
on (keyPress "<Right>"){
gotoAndPlay("startR")
}
for some reason when export the movie, i can jump (startJ animation) while moving right, but not moving left. Why is that?
please reply ASAP.
thank you
Help With Game Codes
I recently started using flash, and I have the animation part down fine, but I would like to try games. I saw some examples of coding and it looks similar to Interactive Fiction, with which I am familiar. My question is: Where do you put the code? and which tutorial is best to begin with? Thank you.
Key Codes Problem
PHP Code:
if(Key.isDown(Key.90)){
this.gotoAndStop("walk_right")}
By pressing Z (the key code should be 90) you should go to the walk right frame,(this is just a test) but it says:
PHP Code:
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 49: ')' or ',' expected
if(Key.isDown(Key.90)){
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 52: Unexpected '}' encountered
}
Total ActionScript Errors: 2 Reported Errors: 2
Any help here?
Button Codes
Hello, i am nickclick2 and this is my first post. Anyway, what would codes be for these 3 button commands?
1. I want it to stay in the same scene, but go to the first frame.
2. i want it to go to the first frame of the next scene.
3. i want it to go to the first frame of the previous scene.
Thanks!
This is for F8
Why Not This Codes Not Working
Code:
var cat_pointer:MovieClip = new MovieClip();
var mcLoader:MovieClipLoader = new MovieClipLoader();
var cat_listner:Object = new Object();
cat_listner.onLoadComplete = function(image_mc:MovieClip):Void {
trace(image_mc.cat_id)) // says undefined
}
function populate_cat_images(in_arr:Array, element:Number):Void {
for (i=0; i<in_arr[element].product.length; i++) {
cat_pointer.attachMovie("catagory_images", "img_holder"+i, cat_pointer.getNextHighestDepth(), {_y:115*i+5, _x:5});
cat_pointer["img_holder"+i].cat_id = in_arr[i].cat_id;
mcLoader.loadClip(in_arr[element].product[i].prd_thmbb, cat_pointer["img_holder"+i]);
}
mcLoader.addListener(cat_listner);
}
populate_cat_images(myArray, 5)
why does the trace statement on onLoadComplete says undefined???
[CS3] Where To Place These Codes
in AS3
...been following this tutorial. As u scroll to middle of that page u will see this code:
Quote:
enemy1.x = 0;
enemy1.y = 0;
enemy1.health = 50;
trace(enemy1.health);
Quote:
newhealth = enemy1.damage(10);
i have looked at example .fla and .as, but still couldn't see where this codes go, any idea?
thanks
Help Combining Two Codes
I found these two codes online, the first code centers an object and sets a button to set full browser mode... and the second code that I found centers and object and tiles a background in full browser.
Now I tried to combine them so to achieve background tilling in full browser mode but the tiles will not cover the whole browser.
this is the full browser with background tiles code. I got the code from here:
http://www.gotoandlearn.com/player.php?id=31
Code:
import flash.display.BitmapData;
cover._x = Stage.width / 2;
cover._y = Stage.height / 2;
var tile:BitmapData = BitmapData.loadBitmap("tile");
function fillBG() {
this.beginBitmapFill(tile);
this.moveTo(0,0);
this.lineTo(Stage.width,0);
this.lineTo(Stage.width,Stage.height);
this.lineTo(0,Stage.height);
this.lineTo(0,0);
this.endFill();
}
fillBG();
var stageL:Object = new Object();
stageL.onResize = function() {
fillBG();
cover._x = Stage.width / 2;
cover._y = Stage.height / 2;
}
Stage.addListener(stageL);
///////////////////////////////////////////////////////////////////////////////////////////////////
And this is the full browser code. I got the code from here:
http://www.bezzmedia.com/swfspot/tut...een_Flash_Mode
Code:
1.
//Don't scale the movie when the stage size changes
2.
Stage.scaleMode="noScale";
3.
//Align the stage to the top left
4.
Stage.align = "TL";
5.
//Function to toggle between fullscreen and normal size
6.
//the toggle fullscreen button calls this function when pressed
7.
function toggleFullScreen(){
8.
//if normal size, go to fullscreen, else go to normal size
9.
if(Stage["displayState"]=="normal"){
10.
Stage["displayState"]="fullScreen";
11.
}else{
12.
Stage["displayState"]="normal";
13.
}
14.
}
15.
//Create a listener for each time the Stage is resized
16.
var resizeListener:Object = new Object();
17.
//Called each time the stage is resized
18.
resizeListener.onResize = function () {
19.
//Move the button to the center of the screen
20.
toggleFullScreenButton._x=Stage.width/2;
21.
toggleFullScreenButton._y=Stage.height/2;
22.
}
23.
//Add the listener to Stage
24.
Stage.addListener(resizeListener);
25.
//////////////////////////////////////////////////////////////////////////////////////////
And this is the combination of the above two codes that didn't work for me.
Code:
//Don't scale the movie when the stage size changes
Stage.scaleMode="noScale";
//Align the stage to the top left
Stage.align = "TL";
//Function to toggle between fullscreen and normal size
//the toggle fullscreen button calls this function when pressed
function toggleFullScreen(){
//if normal size, go to fullscreen, else go to normal size
if(Stage["displayState"]=="normal"){
Stage["displayState"]="fullScreen";
}else{
Stage["displayState"]="normal";
}
}
//Create a listener for each time the Stage is resized
var resizeListener:Object = new Object();
//Called each time the stage is resized
resizeListener.onResize = function () {
//Move the button to the center of the screen
main_mc._x=Stage.width/2;
main_mc._y=Stage.height/2;
}
import flash.display.BitmapData;
main_mc._x = Stage.width / 2;
main_mc._y = Stage.height / 2;
var tile:BitmapData = BitmapData.loadBitmap("tile");
function fillBG() {
this.beginBitmapFill(tile);
this.moveTo(0,0);
this.lineTo(Stage.width,0);
this.lineTo(Stage.width,Stage.height);
this.lineTo(0,Stage.height);
this.lineTo(0,0);
this.endFill();
}
fillBG();
var stageL:Object = new Object();
stageL.onResize = function() {
fillBG();
main_mc._x = Stage.width / 2;
main_mc._y = Stage.height / 2;
}
//Add the listener to Stage
Stage.addListener(resizeListener);
///////////////////////////////////////////////////////////////////////////////////////////
Anyone knows how I can combine these two cods effectively so that the background tile, covers the whole browser in full browser mode in all screen resolutions?
Thank you
[F8] Endless War Codes
Does anyone know the codes or a tutorial how to make a game like endless war 3 like.
Guns (Atleast 15)
Gernade Throw
Smart NCP/Enemies
Player commands to give other troops orders (To move around)
Please help me out to save my flash game!
In Advance Thanks!
Codes (as In Ciphers)
I'm developing a game that gives you save data in the form of a text block. I'd like to be able to encode a string such as "x=5342;y=234;health=83" into something unreadable that can easily be decoded with the key.
I don't want people to be able to mess around with the code and change the save data; so i want something fairly complex
any ideas would be appreciated, preferably with sample script.
If Else With States And Zip Codes
I'm having trouble with my script..
I'm making a form that directs you to the proper person in that area.
When I try inputing another state such as NY it keeps outputting "John Doe 2" instead of the proper name.
Here is my script. I don't know if I can't switch up zip and state..
Any help would be greatly appreciated !
on (release) {
if (zip>15000 && zip<16899) {
name = "John Doe";
}
else if (zip>16900 && zip<19699) {
name = "John Doe 2";
}
else if (state = "NJ") {
name = "John Doe 3";
}
else if (state = "NY") {
name = "John Doe 4";
}
}
Converting Codes
on (release) {
data.email = email;
data.name = name;
data.message = message;
data.recip = recip;
data.exist = exist;
data.loadVariables('sendmail.php', 'POST');
_parent.status = 'sending now ...';
}
i have this code that is for flash 5 and i have to sxport my movie using flash player 8 so it creates error when exporting i wonder if somebody can convert this flash5 code to flash8 pro
ps:do i have to update sendmail.php codes? i don't know much about php
ignore lines starting with // (comments)
Code:
<?php
// list all vars to be expected from the movie
$vars = array("name", "email", "message", "recip", "exist");
// and import them into the script
foreach($vars as $var)
if(isset($_POST[$var]))
$$var = $_POST[$var];
else
$$var = '';
// check variables
//if(strlen($name) < 3)
//die("&status=please enter a real name&");
//if(!eregi('^([a-z0-9._-])+@([^.]+.[^.]+)', $email, $matched))
//die("&status=please enter a correct email address&");
//else if(!getmxrr($matched[2], $mxrr))
//die("&status=your mail server does not seem to exist&");
// where to send it
// remove or configure one of the two code blocks
// otherwise your mail will be sent to johnnybegood@hotmail.com :)
//**** this one for the selectable recipients ****
//$recips = array("support" => "support@somesite.com", "account" => "billing@somesite.com");
//$recip = $recips[$recip];
// if something went wrong, send to default address
//if(empty($recip)) $recip = "support@somesite.com";
// ***** end selectable recipient ********
// ***** or one fixed recipient ******
$recip = "sepehr.online@gmail.com";
//**** end fixed recipient *******
// build up message
// this code for any multiline text fields
$message = str_replace("
", "
", $message);
// info vars
$sender = $_SERVER[REMOTE_ADDR];
// you can rearrange this - just do not add or remove quotes
$mailbody = "Contact form sent by
Name: $name
Email: $email
//Existing customer? $exist
message:
$message
-------
sender's ip: $sender";
// send it off
// note - if you omit the last part, a few servers do not send mail at all,
// but most would show strange senders like nobody@server17.hostingcompany.com
mail($recip, "contact form", $mailbody, "From: webserver@yoursite.com");
// and tell visitor
print "&status=mail sent - we will be in touch with you shortly&";
?>
The Difference Between The Two Codes?
Hi everyone.
My first post here, and unfortunately it's another question lol
I'm getting my teeth into actionscript at the moment so I can learn how to build websites using flash more efficiently.
I have a situation where a rollover of a button triggers flash to load an external swf in a movieclip with my flash file. Now, here's the code that I wrote (which works) to accomplish this:
Quote:
on (rollOver) {
this._parent.holder_Mc.loadMovie("bar_Glasgow.swf" );
}
on (rollOut) {
this._parent.holder_Mc.unloadMovie();
}
However, I thought that I'd see how flash created the actionscript using the behaviours tool. It came up with something slightly different:
Quote:
on (rollOver) {
if(this._parent.holder_Mc == Number(this._parent.holder_Mc)){
loadMovieNum("bar_Glasgow.swf",this._parent.holder _Mc);
} else {
this._parent.holder_Mc.loadMovie("bar_Glasgow.swf" );
}
}
on (rollOut) {
if(this._parent.holder_Mc == Number(this._parent.holder_Mc)){
unloadMovieNum(this._parent.holder_Mc);
} else {
this._parent.holder_Mc.unloadMovie();
}
}
I was hoping some of you actionscript genius could tell what exactly is the difference? Is it more 'proper' writing this little script? I'm still learning actionscript at the moment, so whilst my knowledge is growing, I'm still stuck on some things.
Thanks in advance!
Help With Interpreting Some AS1.0 Codes
I want to use some of these AS1.0 codes for my game. But I dont really understand AS1.0. I would really appreciate it if somebody could help me convert them to AS2.0 or just explain how they work. Thanks in advance.
Code:
n = 1;
text = "Hello there.";
//----------------------------------------------
//clear out old text (NOTE: the first time you do this, there isn't any text to clear out! I just keep the code here because it doesn't do any harm.)
//----------------------------------------------
c = 1;
while (Number(c)<=100) {
removeMovieClip("../font" add c);
c = Number(c)+1;
}
Code:
length = length(text);
if (Number(n)<=Number(length)) {
//----------------------------------------------
//move cursor
//----------------------------------------------
setProperty("", _x, Number(fontx)+Number((fontwidth*(n))));
}
Code:
if (Number(n)<=Number(length)) {
//----------------------------------------------
//type new character
//----------------------------------------------
duplicateMovieClip("../original", "font" add n, n);
set("../font" add n add ":text", substring(text, n, 1));
setProperty("../font" add n, _x, Number(fontx)+Number((fontwidth*(n-1))));
setProperty("../font" add n, _x, getProperty("../cursor", _x)-fontwidth);
setProperty("../font" add n, _y, getProperty("../cursor", _y));
n = Number(n)+1;
gotoAndPlay(_currentframe-1);
}
You can download the fla file here
Help Me To Simplify These Codes
I don't know how to convert normal name which has number at the end into index name.
All my MC instance are created by dragging from the Library into stage and name them manually (e.g. MC1, MC2, MC3...MC22). For any MC that are not within another MC, I can use "this" to make them indexed. Here's my current practice:
for (var i=1; i<22; i++) this["MC"+i].visible = false;
But if the MC is inside another MC, I can't make it like this:
for (var i=1; i<22; i++) ParentMC.this["MC"+i].visible = false;
So whats wrong? If you don't understand my question, please help me simplify these codes into "for loop". These are working codes:
ActionScript Code:
var mySharedObject:SharedObject = SharedObject.getLocal("kurinbox");
mySharedObject.data.name1 = "Anonymous";
mySharedObject.data.name2 = "Anonymous";
mySharedObject.data.name3 = "Anonymous";
mySharedObject.data.name4 = "Anonymous";
mySharedObject.data.name5 = "Anonymous";
mySharedObject.data.name6 = "Anonymous";
mySharedObject.data.name7 = "Anonymous";
mySharedObject.data.name8 = "Anonymous";
mySharedObject.data.name9 = "Anonymous";
mySharedObject.data.name10 = "Anonymous";
mySharedObject.flush();
Menu_Main_MC.hsName1.text = mySharedObject.data.name1;
Menu_Main_MC.hsName2.text = mySharedObject.data.name2;
Menu_Main_MC.hsName3.text = mySharedObject.data.name3;
Menu_Main_MC.hsName4.text = mySharedObject.data.name4;
Menu_Main_MC.hsName5.text = mySharedObject.data.name5;
Menu_Main_MC.hsName6.text = mySharedObject.data.name6;
Menu_Main_MC.hsName7.text = mySharedObject.data.name7;
Menu_Main_MC.hsName8.text = mySharedObject.data.name8;
Menu_Main_MC.hsName9.text = mySharedObject.data.name9;
Menu_Main_MC.hsName10.text = mySharedObject.data.name10;
Refactoring AS Codes
Is there any IDE out there that can help code refactoring (just like the JAVA codes refactoring with Eclipse) in Flash developlemnt?
Keys Codes Help
Hello, i am working on something very important for me but
i have one problem.
How can i know the codes of every keys (code like 88 = z..u know what i mean)?
If there is any guides that will explain it to me it also will help...
Problems With Codes
This error message keeps popping up, when i try to use the following code for my button in my interactive flash quiz:
stop();
btn.onRelease = function(){
_root.answer1.text = "Wrong Answer ";
}
This is the error message:
1120: Access of undefined property oneB.
What does it mean?
i also get another compiler error message:
1120: Access of undefined property _root.
Edited: 12/30/2008 at 09:13:46 PM by cherrllovemail
Useful Codes With Tuts And Fla's
**Sorry, i have not yet found all my FLA's, i'll put them up soon
MC's As Buttons[FLA] || [Preview]
1
Draw a Picture.
2
Select it and press F8 and make sure Button is checked.
3
Double click it and insert keyframes under the Up, Over, Down, Hit.
Up is the button whenever the pointer is not over the button.
Over is representing the button’s appearance when the pointer is over the button.
Down is representing the button’s appearance as it is clicked.
Hit is defining the area that responds to the mouse click. This area is invisible in the SWF file.
4
Once it is a button and you have all the states add in;
Code:
on (release){
//action
}
For E.G.:
Code:
on (release){
gotoAndPlay("6");
}
//this will go to and play frame 6
Code:
on (release){
gotoAndPlay("part 2");
}
//this will go to and play frame named part2
Set Timer, By Using A Button[FLA] || [Preview]
1
To frame 1, or whatever frame the button is in, add in this code;
Code:
_root.notime = 0; //this is a variable the code i made uses to make sure the timer only sets when it is not already counting down
2
OK, in this code i have just used a movie clip to act as a button, but you can use a button. Add this code to your button;
Code:
on (rollOver) {
this.gotoAndPlay(2); //this just plays the rollover frame of my movie clip, if you have a button delete the code in red
}
on (rollOut) {
this.gotoAndPlay(21); //this just plays the rollout frame of my movie clip, if you have a button delete the code in red
}
on (release) {
if (_root.notime>=1) { //checks to see if the variable notime is 1
_root.text.gotoAndPlay(); // if it is 1, then it will not start the timer again
} else if (_root.notime<=0) {//checks to see if the variable notime is 0
_root.text.gotoAndPlay(2); // if it is 0, then it will start the timer
}
}
3
Make a symbol with the instance name of text. In it, put a dynamic text box named display. After you have put in the text box put in another keyframe at frame 2.
NOTE** if you want it invisible set the alpha of this movie clip to 0.
4
In frame 1 of the symbol put in this code;
Code:
stop();
_root.text.display = 45; //Sets the timer variable to 45, just looks good if it is visible. Make this the same as the actual timer.
5
In frame 2 of the symbol put in this code;
Code:
_root.notime = 1; //Make the button invalid until the timer makes it valid again
var numTimeLimit = 45000; // This sets the timer. 1 sec = 1000, so this is for 45 seconds
var bolFirstTime = true;
function countDownF() {
if (bolFirstTime) {
numTimeStart = getTimer();
bolFirstTime = false;
}
numTimePassed = getTimer() - numTimeStart;
display = Math.round((numTimeLimit - numTimePassed)/1000);
if (numTimePassed > numTimeLimit) { // If the timer is finished
_root.notime = 0; //Set notime to 0, so the button will work again!.
gotoAndPlay(1); //Goes back to frame one of this symbol also so the button will work properly or, alternatavely, you can leave out the code in green so they have to double click the button for it to work .
//Put in any of your own actions here.
clearInterval(countDownI); // clear the interval
}
}
countDownI = setInterval(countDownF, 50);
stop();
Mouse Out/Mouse Over Using MC's[FLA] || [Preview]
1
Create a movie clip.
2
Insert 6 keyframes for example, frames 1, 2, 20, 21, 40, 41.
3
On 4 of the keyframes, for example, frames 1, 20, 40, 41, on each of these keyframes put in;
Code:
stop();
4
Put your idle picture on frame 1, and your rollOver animations on keyframe 2 - 20, for this example.
5
Put your rollOut animations on the keyframe 21 - 40, for this example.
6
Put your pressed animations on the keyframe 41, for this example.
7
Go back to scene 1 and put this code on your movieclip;
Code:
on (rollOver) {
this.gotoAndPlay("roll in scene"); //goto And Play from roll in scene of this MC
}
on (rollOut) {
this.gotoAndPlay("rollout scene");//goto And Play from rollout scene of this MC
}
on (press) {
this.gotoAndPlay("pressed scene");//goto And Play from pressed scene of this MC
}
on (release) {
this.gotoAndPlay("idle");");//goto And Play the idle scene of this MC
}
Make Button Text Fade In/OutUpdates have been made, no more Freezing up on load, and if you download the fla, remove the code from frame 1![FLA] || [Preview]
OK, so try putting the text as a movie clip(f8) and then add
-1: To the Frame add;
Code:
//you no longer need a code here
-2: To The Button(we'll call ButtonA) add;
Code:
on (rollOver) { //checks if the mouse is over
_root.pizza = 1; //sets the variable, called pizza to 1
_root.meh= 0; //sets the variable, called meh to 0
}
-3: Insert the text and make it a movieclip, name it text, in the properties menu. Make sure it is the instance name and not the symbol name.
-4: Make the alpha of the movie clip 0%
-5: To the movie clip add; **Fixed**
Code:
onClipEvent (enterFrame) {
if (_root.pizza == 0) {
_root.text._alpha -= 10;
_root.meh=1;
}
if (_root.text._alpha<=0) {
_root.text._alpha -= 0;
}
if (_root.text._alpha>=100) {
_root.text._alpha += 0;
}
if (_root.pizza == 1) {
_root.text._alpha += 10;
}
}
-6: To The Next Button(we'll call ButtonB) add;
Code:
on (rollOver) { //checks if the mouse is over
_root.pizza = 0; //sets the variable, called pizza to 0
_root.meh= 1; //sets the variable, called meh to 1
}
-7: Insert the next text and make it a movieclip, name it text2, in the properties menu. Yet again, make sure it is the instance name and not the symbol name.
-8: Make the alpha of the movie clip 0%
-9: To the movie clip add; **Fixed**
Code:
onClipEvent (enterFrame) {
if (_root.meh == 0) {
_root.text2._alpha -= 10;
_root.pizza = 1;
}
if (_root.text2._alpha<=0) {
_root.text2._alpha -= 0;
}
if (_root.meh == 1) {
_root.text2._alpha += 10;
}
if (_root.text2._alpha>=100) {
_root.text2._alpha += 0;
}
}
NOTE: If you want to make it go to a certain frame put in this code, on the button in this code it will go to and play 3;
Code:
on (rollOver) { //checks if the mouse is over
_root.pizza = 0; //sets the variable, called pizza to 0
_root.meh= 1; //sets the variable, called meh to 1
}
OR, depending on the button
on (rollOver) { //checks if the mouse is over
_root.pizza = 1; //sets the variable, called pizza to 1
_root.meh= 0; //sets the variable, called meh to 0
}
on (release) { //checks if the mouse is released
gotoAndPlay(3);
}
And the new code for the frame will be;
Code:
_root.pizza = 0; //sets the variable, called pizza to 0
_root.meh = 0; //sets the variable, called meh to 0
stop(); //just stops the frame from playing
And if you wanted it do go on mouse out i would be;
Code:
on (rollOver) { //checks if the mouse is over
_root.pizza = 0; //sets the variable, called pizza to 0
_root.meh= 1; //sets the variable, called meh to 1
}
OR, depending on the button
on (rollOver) { //checks if the mouse is over
_root.pizza = 1; //sets the variable, called pizza to 1
_root.meh= 0; //sets the variable, called meh to 0
}
on (rollOut) { //checks if the mouse is out
_root.pizza = 0; //sets the variable, called pizza to 0
_root.meh= 0; //sets the variable, called meh to 0
}
on (release) { //checks if the mouse is released
gotoAndPlay(3);
}
Looping Codes..?
how do u make the codes for a frame loop without flash sayin an error?
Help With Secret Codes
Hey all,
I'm looking to make secret codes for my site. Basically I have flash on the header of my page, i want people to type in a code like u would for let's say playstation cheats..
Say they press left, down, up and right in that order it tells the flash to do something.. is this possible? Events in flash being triggered by a certain order of keys?
Btw to stop confusion, I don't mean type into a box, i mean just press the keys, people aren't sposed to know about it, it's similar to a cheat code, they get to see a special video if they know about it..
I hope I've explained well, if you're unsure of something just ask..
Thanks in advance!
Ben
Number 'Codes'
ive searched this forum and the flash help for the code thingswhen you put if(Key.isDown("") etc..
Conflicting Codes
Hi All
I have two codes on my main page. One makes my juke box dragable and one controls my dragable slider. The problem is if i implement the juke box code it sends the slider code mental, I guess this is to do with the fact that both codes are using the startDrag function. Is there a way around this without losing the functionality of it?
This one to enable my juke box to be dragable...
var left:Number;
var top:Number;
var right:Number;
var base:Number;
onEnterFrame=function(){
left=player_mc._x;
top=player_mc._y;
right=player_mc._x+215;
base=player_mc._y+60;
if ((_xmouse>left)&&(_xmouse<right)&&(_ymouse>top)&&( _ymouse<base)){
player_mc._alpha=100;
}else{
player_mc._alpha=70;
}
};
player_mc.move_btn.onPress=function(){
startDrag(_root.player_mc);
};
player_mc.move_btn.onRelease=function(){
stopDrag();
};
And this one is for my text pages to have a dragable slider
fscommand("allowscale", "false");
bar.useHandCursor = dragger.useHandCursor=false;
space = 20;
friction = 0.9;
speed = 4;
y = dragger._y;
top = main._y;
bottom = main._y+mask_mc._height-main._height-space;
dragger.onPress = function() {
drag = true;
this.startDrag(false, this._x, this._parent.y, this._x, this._parent.y+this._parent.bar._height-this._height);
dragger.scrollEase();
};
dragger.onMouseUp = function() {
this.stopDrag();
drag = false;
};
bar.onPress = function() {
drag = true;
if (this._parent._ymouse>this._y+this._height-this._parent.dragger._height) {
this._parent.dragger._y = this._parent._ymouse;
this._parent.dragger._y = this._y+this._height-this._parent.dragger._height;
} else {
this._parent.dragger._y = this._parent._ymouse;
}
dragger.scrollEase();
};
bar.onMouseUp = function() {
drag = false;
};
moveDragger = function (d) {
if ((dragger._y>=y+bar._height-dragger._height && d == 1) || (dragger._y<=y && d == -1)) {
clearInterval(myInterval);
} else {
dragger._y += d;
dragger.scrollEase();
updateAfterEvent();
}
};
up_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, -1);
};
down_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, 1);
};
up_btn.onMouseUp = down_btn.onMouseUp=function () {
clearInterval(myInterval);
};
MovieClip.prototype.scrollEase = function() {
this.onEnterFrame = function() {
if (Math.abs(dy) == 0 && drag == false) {
delete this.onEnterFrame;
}
r = (this._y-y)/(bar._height-this._height);
dy = Math.round((((top-(top-bottom)*r)-main._y)/speed)*friction);
main._y += dy;
};
};
Why Not This Codes Not Working
Code:
var cat_pointer:MovieClip = new MovieClip();
var mcLoader:MovieClipLoader = new MovieClipLoader();
var cat_listner:Object = new Object();
cat_listner.onLoadComplete = function(image_mc:MovieClip):Void {
trace(image_mc.cat_id)) // says undefined
}
function populate_cat_images(in_arr:Array, element:Number):Void {
for (i=0; i<in_arr[element].product.length; i++) {
cat_pointer.attachMovie("catagory_images", "img_holder"+i, cat_pointer.getNextHighestDepth(), {_y:115*i+5, _x:5});
cat_pointer["img_holder"+i].cat_id = in_arr[i].cat_id;
mcLoader.loadClip(in_arr[element].product[i].prd_thmbb, cat_pointer["img_holder"+i]);
}
mcLoader.addListener(cat_listner);
}
populate_cat_images(myArray, 5)
why does the trace statement on onLoadComplete says undefined???
Useful Codes With Tuts And Fla's
**Sorry, i have not yet found all my FLA's, i'll put them up soon
MC's As Buttons[FLA] || [Preview]
1
Draw a Picture.
2
Select it and press F8 and make sure Button is checked.
3
Double click it and insert keyframes under the Up, Over, Down, Hit.
Up is the button whenever the pointer is not over the button.
Over is representing the button’s appearance when the pointer is over the button.
Down is representing the button’s appearance as it is clicked.
Hit is defining the area that responds to the mouse click. This area is invisible in the SWF file.
4
Once it is a button and you have all the states add in;
Code:
on (release){
//action
}
For E.G.:
Code:
on (release){
gotoAndPlay("6");
}
//this will go to and play frame 6
Code:
on (release){
gotoAndPlay("part 2");
}
//this will go to and play frame named part2
Set Timer, By Using A Button[FLA] || [Preview]
1
To frame 1, or whatever frame the button is in, add in this code;
Code:
_root.notime = 0; //this is a variable the code i made uses to make sure the timer only sets when it is not already counting down
2
OK, in this code i have just used a movie clip to act as a button, but you can use a button. Add this code to your button;
Code:
on (rollOver) {
this.gotoAndPlay(2); //this just plays the rollover frame of my movie clip, if you have a button delete the code in red
}
on (rollOut) {
this.gotoAndPlay(21); //this just plays the rollout frame of my movie clip, if you have a button delete the code in red
}
on (release) {
if (_root.notime>=1) { //checks to see if the variable notime is 1
_root.text.gotoAndPlay(); // if it is 1, then it will not start the timer again
} else if (_root.notime<=0) {//checks to see if the variable notime is 0
_root.text.gotoAndPlay(2); // if it is 0, then it will start the timer
}
}
3
Make a symbol with the instance name of text. In it, put a dynamic text box named display. After you have put in the text box put in another keyframe at frame 2.
NOTE** if you want it invisible set the alpha of this movie clip to 0.
4
In frame 1 of the symbol put in this code;
Code:
stop();
_root.text.display = 45; //Sets the timer variable to 45, just looks good if it is visible. Make this the same as the actual timer.
5
In frame 2 of the symbol put in this code;
Code:
_root.notime = 1; //Make the button invalid until the timer makes it valid again
var numTimeLimit = 45000; // This sets the timer. 1 sec = 1000, so this is for 45 seconds
var bolFirstTime = true;
function countDownF() {
if (bolFirstTime) {
numTimeStart = getTimer();
bolFirstTime = false;
}
numTimePassed = getTimer() - numTimeStart;
display = Math.round((numTimeLimit - numTimePassed)/1000);
if (numTimePassed > numTimeLimit) { // If the timer is finished
_root.notime = 0; //Set notime to 0, so the button will work again!.
gotoAndPlay(1); //Goes back to frame one of this symbol also so the button will work properly or, alternatavely, you can leave out the code in green so they have to double click the button for it to work .
//Put in any of your own actions here.
clearInterval(countDownI); // clear the interval
}
}
countDownI = setInterval(countDownF, 50);
stop();
Mouse Out/Mouse Over Using MC's[FLA] || [Preview]
1
Create a movie clip.
2
Insert 6 keyframes for example, frames 1, 2, 20, 21, 40, 41.
3
On 4 of the keyframes, for example, frames 1, 20, 40, 41, on each of these keyframes put in;
Code:
stop();
4
Put your idle picture on frame 1, and your rollOver animations on keyframe 2 - 20, for this example.
5
Put your rollOut animations on the keyframe 21 - 40, for this example.
6
Put your pressed animations on the keyframe 41, for this example.
7
Go back to scene 1 and put this code on your movieclip;
Code:
on (rollOver) {
this.gotoAndPlay("roll in scene"); //goto And Play from roll in scene of this MC
}
on (rollOut) {
this.gotoAndPlay("rollout scene");//goto And Play from rollout scene of this MC
}
on (press) {
this.gotoAndPlay("pressed scene");//goto And Play from pressed scene of this MC
}
on (release) {
this.gotoAndPlay("idle");");//goto And Play the idle scene of this MC
}
Make Button Text Fade In/OutUpdates have been made, no more Freezing up on load, and if you download the fla, remove the code from frame 1![FLA] || [Preview]
OK, so try putting the text as a movie clip(f8) and then add
-1: To the Frame add;
Code:
//you no longer need a code here
-2: To The Button(we'll call ButtonA) add;
Code:
on (rollOver) { //checks if the mouse is over
_root.pizza = 1; //sets the variable, called pizza to 1
_root.meh= 0; //sets the variable, called meh to 0
}
-3: Insert the text and make it a movieclip, name it text, in the properties menu. Make sure it is the instance name and not the symbol name.
-4: Make the alpha of the movie clip 0%
-5: To the movie clip add; **Fixed**
Code:
onClipEvent (enterFrame) {
if (_root.pizza == 0) {
_root.text._alpha -= 10;
_root.meh=1;
}
if (_root.text._alpha<=0) {
_root.text._alpha -= 0;
}
if (_root.text._alpha>=100) {
_root.text._alpha += 0;
}
if (_root.pizza == 1) {
_root.text._alpha += 10;
}
}
-6: To The Next Button(we'll call ButtonB) add;
Code:
on (rollOver) { //checks if the mouse is over
_root.pizza = 0; //sets the variable, called pizza to 0
_root.meh= 1; //sets the variable, called meh to 1
}
-7: Insert the next text and make it a movieclip, name it text2, in the properties menu. Yet again, make sure it is the instance name and not the symbol name.
-8: Make the alpha of the movie clip 0%
-9: To the movie clip add; **Fixed**
Code:
onClipEvent (enterFrame) {
if (_root.meh == 0) {
_root.text2._alpha -= 10;
_root.pizza = 1;
}
if (_root.text2._alpha<=0) {
_root.text2._alpha -= 0;
}
if (_root.meh == 1) {
_root.text2._alpha += 10;
}
if (_root.text2._alpha>=100) {
_root.text2._alpha += 0;
}
}
NOTE: If you want to make it go to a certain frame put in this code, on the button in this code it will go to and play 3;
Code:
on (rollOver) { //checks if the mouse is over
_root.pizza = 0; //sets the variable, called pizza to 0
_root.meh= 1; //sets the variable, called meh to 1
}
OR, depending on the button
on (rollOver) { //checks if the mouse is over
_root.pizza = 1; //sets the variable, called pizza to 1
_root.meh= 0; //sets the variable, called meh to 0
}
on (release) { //checks if the mouse is released
gotoAndPlay(3);
}
And the new code for the frame will be;
Code:
_root.pizza = 0; //sets the variable, called pizza to 0
_root.meh = 0; //sets the variable, called meh to 0
stop(); //just stops the frame from playing
And if you wanted it do go on mouse out i would be;
Code:
on (rollOver) { //checks if the mouse is over
_root.pizza = 0; //sets the variable, called pizza to 0
_root.meh= 1; //sets the variable, called meh to 1
}
OR, depending on the button
on (rollOver) { //checks if the mouse is over
_root.pizza = 1; //sets the variable, called pizza to 1
_root.meh= 0; //sets the variable, called meh to 0
}
on (rollOut) { //checks if the mouse is out
_root.pizza = 0; //sets the variable, called pizza to 0
_root.meh= 0; //sets the variable, called meh to 0
}
on (release) { //checks if the mouse is released
gotoAndPlay(3);
}
|