Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Coding Problems...



Hey guys,

I have a bar that I want to motion tween in and out of its mask depending on where the mouse is, ive created a movie clip called hitzone_mc and placed the following code onto it...

on(rollOver){
import mx.transitions.Tween;
import mx.transitions.easing.*
var menuinTween:Object = new Tween(sub_menu, "_x", Regular.easeOut, sub_menu._x, (Stage.width - 772.2), 30, false);
}
on(rollOut){
import mx.transitions.Tween2;
import mx.transitions.easing.*
var menuoutTween:Object = new Tween(sub_menu, "_x", Regular.easeIn, sub_menu._x, 0 , 30, false);
}

is there a way to just make a stage area trackable without using a movieclip? if I use a movieclip I cant press any buttons underneath that clip which is a big problem

also I dont want the above movieclip to be active until a variable I have "pagenum" is higher than 0, how do I get it to be checking for that?

I hope im not getting too annoying but I think im dealing with code thats a bit advanced for my talents

I know im only new at this but I appreciate the help given to me so far and if there is ever anything I can do in return just ask, ill be using these forums alot from now on



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 03-01-2007, 04:23 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Coding In The MC
well it seems that I can not figure out how to open the Movie Clips in order to implement the code.
the original MC is called birthday and it has several layers in top of the static layer, where all the MC objects are distribute in layers in other to fade them in and out. however, I can not open the MC to implement the code and call through instances the objects to appear and desapear
__________________
mariusvam@hotmail.com

Coding...
I'm new to Flash MX- i dabbled in Flash 3 but as I now see things have progressed way to much and I'm learing the program all over... I'm trying to find out how to enter code for a frame action. Its to set up a preloading movie clip. Can anyone help? Thanks!

Coding ?
I need a simple code that would allow a image of a card deck to pull up a movie named roleofteacheryesterday

thanks

Coding
This may sound really stupid but how do you achallly put in code. Because i want to make an inventory systom , ive got the code but i dont know where to put it?

Coding Help
I got a sample of some code to move and object up and down , using 'K' and 'M'. All the code makes sense except the variable moveY.

I Have no Idea what it's doing , where it was declared and initialised and how it actually works.

Could someone please explain the Logic of $moveY.


onClipEvent (enterFrame) {

if (Key.isDown(75) && _y>65) {
if (movey>=0) {
moveY =-1;
}else if (moveY>-4) {
moveY*=1.2;
}
keypressed = true;
_y += moveY;
}


if (Key.isDown(77) && _y<250) {
if (movey<=0) {
moveY =1;
}else if (moveY<4) {
moveY*=1.2;
}
keypressed = true;
_y += moveY;
}
if (!keypressed) moveY = 0;
}

Coding Help
how do I make it where You have a picture of a guy and you press a direction button like up, and that picture moves???
Like in a game.

Need Some Help With My Coding...
I have some scrolling buttons that when i click on them, i want them to display a couple of pictures and also some information that describes the pictures. The information will be brought into the textfield from an external file. I have this code inserted on my button. Any help will be apperciated.

[Here's my Code]
---------------------------------------------------------------------
on (release) {
images1.play()
//Load the textfile containing all text for this website
siteData = new LoadVars();
siteData.load("text1.txt");
siteData.onLoad = function(success) {
if (success) {
textbox.text = siteData.myFirstvar;
//trace(siteData.myFirstvar);
//trace(siteData.mySecondvar);
} else {
trace("file NOT found");

}
};
}
---------------------------------------------------------------------

Thanks,
Tony

Help With Coding
Hi,

on my website i want to make a counter that counts down till saturday 11 pm, from saturday 11 pm till sunday 8 am i want to display "party in progress" and at 8 am the counter has to reset and count back down till saturday 11 pm.

Can somebody help me with the coding please ?

thx very much

How Would I Go About Coding This?
the following code doesn't work because each clip duplicates itself, along with the code, ad infinitum, causing a flash error message:

onClipEvent (load) {
this.duplicateMovieClip("script3", 1);
script3._x = this._x + this._width - 1;
}

the above was a failed test!

what i really need to do is make a script that will position a series of mcs next to each other (as in: mc._x = this._x + this._width - 1 so that each of them can then be populated using loadmovie.

also, two of the 11 mcs i am loading are different widths to all the others. how would i go about coding this?

no doubt this is easy if you actually understand actionscript!

any help would be much appreciated!

Swf To Swf Coding
I have a Btn that works great. It's inside a MC inside an swf. I've made a menu that has 10 empty movie clips that pulls the Btn in and everything works great. I just can't seem to coding the Btns. It's a Btn inside a MC inside a SWF being pulled into a MC inside my main time line. I'm trying to make this menu so I can change out the Btns and everything works. Here's my code:

_level0.mc1.mc.btn.onRelease = function() {
getURL("Page","_Blank");

}

I've also tried:

tellTarget (_level0.mc1.mc.btn) {
onRelease = function() {
getURL("Page","_Blank");
}

Anybody have any ideas??? Please???

Just Bad Coding? Please Help
Code:
_root.fromEsp =_root.config.firstChild.childNodes[i].firstChild.toString();//grabs xml data contains a path to a file

trace("location+asset= "+_root.fromEsp)//debug

var assetName = _root.fromEsp.split("\");//split array into back slashes

_root.fileName = assetName.pop();//get file name by "popping" array

pathFile="C:\test\"+_root.fileName //rebuild new path by concat...

gotoAndPlay("calc")//proceed
Hello code kings and queens Im stuck on this one and really need your help.


Im grabbing the path from xml which points to a file.
after the above code I hope to end up with

• the full original filepath "_root.fromEsp"
• the name of file "assetName"
• a rebuilt path which includes the name of file."pathFile"


My problem:
The above works well. BUT if _root.fromEsp is a
path to a movie file (wmf,avi,mpg etc) , trace (on line 2) returns the filename of my movie without the full path???

Really bugging me! if "_root.fromEsp" is a path to a jpeg or swf there is no problem.

hope this makes sense.
Thanks for your time

Cheers

Help With Some Coding Please
Hello, i am a "graphical guy" and new in flash.
Now i wanted to trie some effect in flash that needs a bit coding but i'm a newbie so i wanted to ask if some-one of you could be so kind to help.

this is what i'm trying to achieve:

http://www15.brinkster.com/morreke/howto.jpg [copy and paste url please]

anybody ?

thx

Help With Some Coding...
Ok here it goes...Im ive got a button and when that button is clicked it is to load text into a dynamic text box...every thing is set up correctly but the coding i think is wrong take a look and tell me what you think...

Quote:





on (release) {
= new loadVars();
loadText.load("TEXT1.txt");
loadText.onLoad = function(success) {
if (success) {
// trace(success);
newsBox.html = true;
newsBox.htmlText = this.myNews;
}
};
}

Help With Coding. Thanks
Can anyone teach me or share the coding like the one in the website below? i mean the pictures which can see 360% degree

http://www.sydneyoperahouse.com/sect...ur/vrtour2.asp

Thanks... i need that in my project..

Help With Coding
hei,

just got help from you guys - but i don´t manage to get it right.... (---see attached file)

(the grey rectangle should start fading in when i reach the red square (hit area), not already when you cross the edges of the grey square)

can anyone tell me what i am doing wrong?

taking what you already have, do the following:

1. Inside your movie clip, turn the red box into a movie clip instance and then name it "redSquare" in your properties box.

2. Remove your current functions (all but the stop()) from your first frame of your fading movie clip timeline.

3. Give your fading movie clip placed on _root the name greyBox

4. Assign the following actions to the "redSquare" mc inside the "greyBox" mc:


code:

onClipEvent(enterFrame){
this.onEnterFrame = function(){
if(rewind == true){
_root.greyBox.prevFrame();
}
}

this.onRollOver = function(){
rewind = false;
_root.greyBox.play();
}

this.onRollOut = function(){
rewind = true;
}

this.onRelease = function(){
_root.gotoAndPlay(34);
}
}


This should work for you. It did for me.

Help Coding
PHP Code:



//--------------------------------------------------------------------------
// location of the playlist if no html parameter is found
// change "playlist.xml" if you want another filename ..
//--------------------------------------------------------------------------
_root.playlist == undefined ? playlist = "mp3player.xml" : playlist=_root.playlist;

//--------------------------------------------------------------------------
// below here it's all code and code ..
//--------------------------------------------------------------------------


// stage variables
Stage.showMenu = false;
Stage.scaleMode = "noScale";
stop();

// player variables
volume = 90;
current_song = 1;
top.equalizer._visible=0;

// playlist loading
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = loadData;
data_xml.load(playlist);


// parsing all xml data into flash
function loadData(success) {
    if (success) {
        // showdisplay and playlist toggles
        showDisplay = this.firstChild.attributes.showDisplay;
        if (showDisplay == "yes") {
            top.easeY(toppos);
            topup = false;
            display_btn._rotation+=180; }
        showPlaylist = this.firstChild.attributes.showPlaylist;
        if (showPlaylist == "yes") {
            bot.easeY(botpos);
            botup = false;
            list_btn._rotation+=180; }
        // getting all titles and filenames
        aPath = new Array();
        songTitel = new Array();
        audioTracks = new Array();
        audioTracks.shuffle();
        audioTracks = this.firstChild.childNodes;
        song_total = audioTracks.length;        
        for (var i = 0; i<song_total; i++) {
            aPath.push(audioTracks[i].attributes.path);
            songTitel.push(audioTracks[i].attributes.title);
            // buiding playlist buttons
            bot.playlist.btn.duplicateMovieClip("btn"+i, i);
            bot.playlist["btn"+i]._y = bot.playlist.btn._y+i*int(bot.playlist.btn._height) +i;
            bot.playlist["btn"+i].txt = checkDigits(i+1)+". "+songTitel[i];
            bot.playlist["btn"+i].hit.onPress = function() {
                listClick(this._parent.getDepth()+1); };
        }
        //checking autostart mode
        autoStart = this.firstChild.attributes.autoStart;
        if (autoStart == "yes") {
            playSong();
            play_btn._visible = 0;
        } else if (autoStart == "no") {
            play_btn._visible = 1;
            pause_btn._visible = 0;
        } else if (autoStart == "random") {
            current_song = random(song_total)+1;
            playSong();
            play_btn._visible = 0;
        } else {
            current_song = int(this.firstChild.attributes.autoStart);
            playSong();
            play_btn._visible = 0; } }
    // done ! all loaded succesfully. purging trash
    delete audioTracks;
    delete data_xml;}

// list button
function listClick(prm) {
    delete pausepos;
    current_song = prm;
    MySound.stop();
    playSong(); }
    
// list scroller
bot.list_bg.onEnterFrame = function() {
    if (hitTest( _root._xmouse, _root._ymouse, true) && this._parent.playlist._height > this._height ) {
        ymin = this._y+this._height - this._parent.playlist._height;
        ymax = this._y+3;
        conv = (this._ymouse -15)*1.3/this._height;
        conv > 1 ? conv = 1 : null;
        conv < 0 ? conv = 0 : null;
        this._parent.playlist.easeY (ymax - conv*(ymax-ymin)); } };
bot.playlist.setMask(bot.list_bg);


// play function
function playSong() {
    AudioPath = aPath[current_song-1];
    // checking for pause > start from there
    if (pausePos>0) {
        top.equalizer._visible = 1;
        MySound.start(pausePos, 0);
        pausePos = 0;
    // startup new sound
    } else {
        MySound = new Sound();
        MySound.setVolume(volume);
        MySound.loadSound(AudioPath, true);
        MySound.onSoundComplete = function() {
            top.equalizer._visible = 0;
            if (autoStart == "random") {
                current_song = random(song_total)+1;
            } else {
                current_song == song_total ? current_song = 1 : current_song++;
            }
            playSong(); };
        // check loading bar
        top.track_load.onEnterFrame = function() {
            total = this._parent._parent.MySound.getBytesTotal();
            geladen = this._parent._parent.MySound.getBytesLoaded();
            if (geladen != total) {
                this._parent.load_display = Math.round((geladen*100/total))+"% Loaded";
                this._xscale = Math.round((geladen*100/total));
            } else {
                this._xscale = 100;
                top.equalizer._visible = 1;
                delete this.onEnterFrame;
                delete this._parent.load_display; } }; }
    // switch paly/pause buttons
    play_btn._visible = 0;
    pause_btn._visible = 1; }
    
    
// play button
play_btn.onRelease = function() {
    playSong(); };
    
    
// pause button
pause_btn.onRelease = function() {
    this._visible = 0;
    play_btn._visible = 1;
    pausePos = MySound.position/1000;
    MySound.stop();
    top.equalizer._visible=0;  };
    
    
// next button
next_btn.onRelease = function() {
    delete pausepos;
    current_song == song_total ? current_song = 1: current_song++;
    MySound.stop();
    playSong(); };
    
    
// previous button
prev_btn.onRelease = function() {
    delete pausepos;
    current_song == 1 ? current_song = song_total: current_song--;
    MySound.stop();
    playSong(); };

    
// display toggle button
top.setMask(top_mask);
toppos = top._y;
top._y = int(toppos + top_mask._height - 29);
topup = true;

display_btn.onPress = function() {
    if(topup == true) {
        top.easeY(toppos);
        topup = false; }
    else {
        top.easeY(int(toppos + top_mask._height -27));
        topup = true; }
    this._rotation += 180; };
        
// playlist toggle button

bot.setMask(bot_mask);
botpos = bot._y;
bot._y = botpos - bot.list_bg._height -6;
botup = true;

list_btn.onPress = function() {
    if(botup == true) {
        bot.easeY(botpos);
        botup = false; }
    else {
        bot.easeY(botpos - bot.list_bg._height -6);
        botup = true; }
    this._rotation += 180; };
        
// drag button functionality
drag_btn.onPress = function() {
    startDrag(this._parent); };
drag_btn.onRelease = drag_btn.onReleaseOutside=function () {
    stopDrag(); };

// copyright button
copy.onPress = function() {
  getURL("http://www.jeroenwijering.com/?item=Flash+Mp3+Player","_blank"); }
    
// updating time display
this.onEnterFrame = function() {
    dur = int(MySound.duration/1000);
    pos = int(MySound.position/1000);
    playTime = {};
    playTime.minutes = int((pos)/60);
    playTime.seconds = int((pos)%60);
    playTime.total = checkDigits(playTime.minutes)+":"+checkDigits(playTime.seconds);
    trackTime = {};
    trackTime.minutes = int(dur/60);
    trackTime.seconds = int(dur%60);
    trackTime.total = checkDigits(trackTime.minutes)+":"+checkDigits(trackTime.seconds);
    if (top.load_display == undefined) {
        top.display = playTime.total+" / "+trackTime.total;
    } else {
        top.display = top.load_display; }
    if (top.trackDrag != true) {
        prozent = pos*100/dur;
        top.track_play._xscale = prozent; } };

// prefixing a 0 to the time
function checkDigits(toCheck) {
    return (toCheck<10) ? toCheck="0"+toCheck : toCheck; }
    
    
// track progress slider functions
top.track_back.onPress = function() {
    this._parent.trackDrag = true;
    this._parent.track_play.onEnterFrame = function() {
        perc = (this._parent._xmouse-this._parent.track_back._x)/this._parent.track_back._width;
        max = this._parent.track_load._width/this._parent.track_back._width;
        perc > max ? perc = max: null;
        perc < 0.01 ? perc = 0.01: null;
        this._width = this._parent.track_back._width*perc;
        this._parent._parent.pausePos = (perc*this._parent._parent.MySound.duration/1000); }; };
top.track_back.onRelease = top.track_back.onReleaseOutside = function () {
    delete this._parent.track_play.onEnterFrame;
    this._parent.trackDrag = false;
    MySound.stop();
    playSong(); };

    
// volume slider functions
vol_back.onPress = function() {
    vol_front.onEnterFrame = function() {
        perc = (_xmouse-vol_back._x)/vol_back._width;
        perc > 0.95 ? perc = 1: null;
        perc < 0.05 ? perc = 0: null;
        this._width = vol_back._width*perc;
        volume = Math.round(perc*100);
        MySound.setVolume(volume);
        top.equalizer._yscale = volume; }; };
vol_back.onRelease = vol_back.onReleaseOutside=function () {
    delete vol_front.onEnterFrame; };
vol_front.setMask(vol_mask);

// drawing equalizer in actionscript
top.equalizer.setMask(top.eq_mask);
top.equalizer.onEnterFrame = function() {
    i++;
    this.createEmptyMovieClip("graph"+i, i);
    with(this["graph"+i]) {
        _x = 0;
        _y = 0;
        beginFill(0x666666, 50);
        moveTo(0,0);
        for (j=0; j< 36; j++) {
            z = random(12)+8;
            lineTo(j*6,-1);
            lineTo(j*6,-z);
            lineTo(j*6+4,-z);
            lineTo(j*6+4,-1);
            lineTo(j*6,-1); }
        lineTo(j*6,0);
        lineTo(0,0);
        endFill(); }
    i >= 3 ? i=0: null; };

    
// scrolling the display song title
function scrollTitle() {
    top.title.txt.autoSize = true;
    if (songTitel[current_song-1].length > 20) {
        top.title.txt.text = songTitel[current_song-1]+"     "+songTitel[current_song-1];
        top.title._x+top.title._width/2 +4< top.title_mask._x ? top.title._x = top.title_mask._x : top.title._x--; }
    else {
        top.title.txt.text = songTitel[current_song-1];
        top.title._x = top.title_mask._x-3; } }
top.title.setMask(top.title_mask);
setInterval(scrollTitle, 40);


// easing display and playlist movement
MovieClip.prototype.easeY = function(t) {
    this.onEnterFrame = function() {
        this._y = int(t-(t-this._y)/1.5);
        if (this._y>t-1 && this._y<t+1) {
            delete this.onEnterFrame; } }; };





That's a code from my .fla file. How would i make it so that instead of the variables showing in the .xml file, they are defined in the [html]<object></object>[/html] code? i understand that this will make the variables visible in view source and i am fine with that.....

CE Coding
Hello!

I found this fla in the movies section, I was modifying it when I found out, that when I was changing the actionscript code, the Central European coding wasn't detected, the letters š, č, ž were not displayed in the swf. I used the Arial CE font and it didn't help either.

Please help

theredtitan from Slovenia

Help With Coding
here is what i have:
a movie clip calld "plastic"
a movie clip calld "arrow"
a movie clip calld "target"
a move clip calld "foot"
a button call "button"

at first frame i have this codes
Mouse.hide();
arrow._visible = false;
aim = 0;

the button is placed inside the foot movieclip
and the foot movieclip folows the mouse
the target movieclip is placed inside the arrow moviecilp

the arrow movieclip has the following code apllyd to it

onClipEvent(load){

X = this._x;
Y = this._y;

}
onClipEvent(mouseMove){

Xm = _root._xmouse;
Ym = _root._ymouse;

Xdiff = Xm - X;
Ydiff = -(Ym - Y);

radAngle = Math.atan(Ydiff/Xdiff);

if (Xdiff < 0){
corrFactor = 270;
}
else{
corrFactor = 90;
}

this._rotation = -radAngle*360/(2*Math.PI) + corrFactor;
updateAfterEvent();
}

the button has the following code

on (release) {
if (_root.aim == 0) {
_root.arrow._x = this._x;
_root.arrow._y = this._y;
_root.arrow._visible = true;
_root.aim = 1;
}
}

the foot movieclip has the following code

onClipEvent (enterFrame) {
if (_root.aim == 1) {
if (_root.arrow.target._x>_root.plastic._x) {
_root.plastic._x += 10;
}
if (_root.arrow.target._x<_root.plastic._x) {
_root.plastic._x -= 10;
}
if (_root.arrow.target._y>_root.plastic._y) {
_root.plastic._y += 10;
}
if (_root.arrow.target._y<_root.plastic._y) {
_root.plastic._y -= 10;
}
}
}

what i was trying to do is to tell the plastic to go to the target
but it goes some place else not relly sure were
plz help me solve this

M:I:Coding?
I can't possibly describe this but I can't seem to get :


Code:
on (release) {
gotoAndStop("mainXrave", 1);
}
This to WORK! its set on a button in a scene but it isn't working!

-In the scene-
A customised cursor, controlled by this._x = _xmouse, and etc
A weird aurora thing as a Movieclip I got using tutorials, 3 frames and just duplicates itself for the efect.
And the not-so-working-well BUTTON.

So what could possibly stop such a easy code not work?

Thanks
Tongxn

AM:I:CODING?!?

Help With Coding Please
Hi everyone, I have been trying to alter this script for a while to better suit my needs but I have not been able to do what I hope to achieve. This is the scrpit for a SIMON game that randomly creates a patter (well I think most people know this) I am trying to use its randomness and other functions without the random string getting longer ( I want it to keep playing new patternes of 3 sounds every time)
There is a variable "step"
and a variable "count"
that seem to control the lenght of the pattern the script creates but I cant think of how to make it do what I said above.

Could anyone take a look and see please?

Code:
var dim = 50; //Alpha of pieces when clicked
aPieces = new Array(); //Array of pieces
aMoveList = new Array(); //Array of moves made
var ID;
var count = 0; //Number of moves made
var first;
var soSound0 = new Sound(this); //Creates a new Sound
soSound0.attachSound("simonSound1.mp3"); //Attaches simonSound1.mp3 to that sound
var soSound1 = new Sound(this);
soSound1.attachSound("simonSound2.mp3");
var soSound2 = new Sound(this);
soSound2.attachSound("simonSound3.mp3");
var soSound3 = new Sound(this);
soSound3.attachSound("simonSound4.mp3");
var step = 0;
for (var i = 1; i < 5; i++) //Adds the four movie clip quadrants to aPieces
{
aPieces.push(this["m" + i]);
this["m" + i].value = i - 1;
}
function buildPieces()
{
for (var i = 0; i < aPieces.length; i++)
{
aPieces[i].onPress = function() //When the piece is pressed it dims
{
this._alpha = dim;
};
aPieces[i].onRollOut = function() //When you roll your mouse off of the piece it undims
{
this._alpha = 100;
};
aPieces[i].onRelease = function() //When you release your mouse
{
this._alpha = 100; //Set transparency to 100%
_root["soSound" + this.value].start(0); //Play the piece sound
if (aMoveList[step] != this.value) //If the piece you pressed does not equal the piece you were supposed to press
{
failure(); //failure method
return;
}
step++; //Add one to the amount of steps to do
if (step == aMoveList.length)
{
nextLevel(); //Go to the next level
}
};
}
}
function failure()
{
tMainText.text = "Game Over.";
killPieces();
mStart._alpha = 100; //Set start button transparency back to 100%
aMoveList = new Array(); //Delete array of moves
mStart.onRelease = function() //Recreate the start button
{
startGame();
}
}
function killPieces()
{
for (var i = 0; i < aPieces.length; i++) //Deletes all the functions of the pieces so you cant interact with them
{
delete aPieces[i].onPress;
delete aPieces[i].onRollOut;
delete aPieces[i].onRelease;
}
}
function lightUp(num)
{
clearInterval(ID);
count--;
if (count == 0) //If no more pieces are left to light up, wait for user to input sequence
{
userTurn();
return;
}
if (count == 1) //If the last piece in the list has just been lit up, pick a random light to light up
{
num = Math.floor(Math.random() * 4);
}
else //Set num to the next light to light up
{
num = aMoveList[aMoveList.length + 1 - count];
}
light(num); //Light up the light
}
function userTurn()
{
step = 0; //Sets the step to 0
buildPieces(); //Lets user interact with pieces
}
function light(num)
{
dimIt(num); //dims the num piece
ID = setInterval(pause, 500, num); //Light up the piece for half of a second
}
function pause(num)
{
clearInterval(ID);
unDim(num);
ID = setInterval(lightUp, 50, num); //Creates a 50ms pause between lighting up pieces
}
function dimIt(num)
{
if (count == 1)
{
aMoveList.push(num);
}
_root["soSound" + num].start(0); //Plays the sound when lighting a piece up
aPieces[num]._alpha = 50;
}
function unDim(num)
{
aPieces[num]._alpha = 100;
}
function startGame()
{
first = Math.floor(Math.random() * 4) //Picks first piece
tMainText.text = ""; //Sets the text field to display nothing
for (var i = 0; i < aPieces.length; i++)
{
aPieces[i]._alpha = 100; //Sets all the pieces to 100% transparency
}
mStart._alpha = 0; //Sets the start button to invisible
delete mStart.onRelease; //Deletes the start button onRelease function
buildPieces();
count = 1;
light(first); //Lights first piece
}
function nextLevel()
{
killPieces(); //Disables interacting with pieces
for (var i = 0; i < aPieces.length; i++)
{
aPieces[i]._alpha = 100; //Sets all pieces to 100% transparency
}
count = aMoveList.length + 1;
var timer = getTimer();
this.onEnterFrame = function()
{
if (timer < getTimer() - 1000) //Wait 1 second before starting sequence display after input
{
delete this.onEnterFrame;
light(first);
}
};
}
mStart.onRelease = function()
{
startGame();
};
Thanks Very Much

Mark

[F8] Gun Coding
1. how do I say in a code that the movieclip 'gun' is inside the movieclip 'arm?

2. I have a very dodgy code here...my 'gun' movieclip is inside the 'arm' movieclip. they point to the mouse using the code attached to them.

the gun fires, the bullet doesn't. the bullet doesn't move anywhere, it stays at its starting point...

heres the code, this lot is all attached to my actions layer:

code: z=10;
bulletSpeed = 30;
var radians:Number = gun._rotation *Math.PI/180;
var vx:Number = Math.cos(radians)
var vy:Number = Math.sin(radians)


onMouseDown = function() {
shoot();
}

function shoot() {
attachMovie('bullet', 'bullet'+ z, z);
rad = gun._rotation*Math.PI/180;
_root['bullet'+z]._y=gun._y+ (25 *Math.sin(rad));
_root['bullet'+z]._x=gun._x+ (25 *Math.cos(rad))

_root['bullet'+z]._rotation=gun._rotation;
var vx3:Number = Math.cos(rad) * bulletSpeed+vx;
var vy3:Number = Math.sin(rad) * bulletSpeed+vy;
_root['bullet'+z].onEnterFrame = bulletMove;
z++
}

function bulletMove():Void
{
this._x += vx3;
this._y += vy3;
}

P.S. is it possible to attach a bullet to another layer when it is fired, so that when it hits its target and stays there, it scrolls along with the background (which is on a different layer)?

Coding Help
Actually this is 2 questions 1 on topic and one out of curiosity.

Now I usually don't have a problem doing a gotoAndPlay but for some reason i'm getting errors.

on (release) {
gotoAndPlay (scene, 1);
}

I'm getting nothing...but errors


And the second question. What are the fundamental differences with Actionscript 2.0 and 3.0 because I making the graphics for an experimental flash RPG and want to know what I should use.

New To Coding
hi there
I bougth this component plugin for my Flash CS3 called WaveNav but I am a beginner in coding.
I was going to use this WaveNav-sample that comes with plugin for my navigation. I have 14 "buttons" I need to navigate on my site but as I said I am a beginner in coding.
Can enyone help me seti it up?

below is the as from the sample:

import com.flashrelief.events.WaveEvent;
//create an array of movie clips to use in the navigation
var wordArr=["home","gallery","videos", "blog","portfolio","resume","about us","contact","legal"]
var tArr = [];
for(var i=0;i<9;i++){
var mc = new TextHolder();
mc.alpha = .65;
mc.tField.autoSize = TextFieldAutoSize.LEFT;
mc.tField.text = wordArr[i];
tArr.push(mc);
}
//assign the array to the component
myWave.items = tArr;
// create events for the links
myWave.addEventListener(WaveEvent.MOUSE_DOWN, goDown);
myWave.addEventListener(WaveEvent.MOUSE_OVER, goOver);
myWave.addEventListener(WaveEvent.MOUSE_OUT, goOut);
//

function goDown(e:WaveEvent){
trace("numer clicked: "+ e.num);
trace("targed movieclip: " + e.targ)
}
function goOver(e:WaveEvent){
var mc = e.targ;
mc.alpha = 1;
}
function goOut(e:WaveEvent){
var mc = e.targ;
mc.alpha = .65;
}


Thanks in advance,

solvin

Help With Coding Please
Hi all hoping some one could tell me with a problem that I have.
What I have is six different bingo cards on the page all with different instance names and each card has 25 numbers. I am generating a bingo number and then trying to make any numbers on the cards that equal the generated number invisible. But at the moment the cards are just all disappearing. Here is my code to generate the number and then check all the cards numbers and set the visibility to flase. I also have a list of all the numbers in another movie clip and they are dissapearing just fine with the second line of code but cant seem to get the numbers on the cards to do them same.

ActionScript Code:
var bingonumberlist2 = Math.ceil(Math.random()*75);
_root.numberlist["number"+bingonumberlist2]._visible = false;
for (t = 0; t <=6 ; t++) {
    for(s = 0; s <= 25; s++) {
       eval(_root["bingocard"+t]["card"+t+"number"+s]);
        if (_root["bingocard"+t]["card"+t+"number"+s] == bingonumberlist2);
          _root["bingocard"+t]["number"+s]._visible = false;
}
}

Little Coding Help
Code:
var weapon = _root.onMouseDown=function () {
bc++;
_root.weapons.weapons.weapon.play();
if (bc>1100) {
bc = 1000;
}
duplicateMovieClip("shell", "b"+bc, bc);
if (_root.automatic==true) {
auto = function () {
bc++;
duplicateMovieClip("shell", "b"+bc, bc);
};
setTimeout (this, "auto", 100, true);
}
};
}
This is my code ^^ for my game, the bits in bold are the important bits.

I am trying to make it so that if the mouse is held down it repeatedly duplicates a movie clip if var automatic is true, above is what i came up with. But at the moment, instead of creating lots of instances of the movie clip, it just creates 1 extra one, how would i make it so it makes lots, each appearing at a 0.1 second interval?

Coding Help
I'm working on a site http://vid.nickwhitehouse.com and I'd like to be able to add images which link to .flvs via XML - I'd also like to be able to slide horizontally (never ending stage) kinda like http://www.chromazone-imaging.co.uk/flashindex.html or http://www.marilynmanson.com/ across all the images/flvs and when the main links (home/musicvideos/comercial etc) are clicked have the stage move to that section of videos?

If anyone could help point me in the right direction I'd be very greatful. I'm willing to pay if some one where to help code it up??

Anyways PM me if you want to help etc
Cheers,

>= And <= Coding... Help Please?
Hey, i'm making a virtual cop type shooter game (your are the corsshair and u shoot the enemes), i set all that up good but i'm having trouble with the health function, i have 3 symbols for health, and a health dynamic text box (not seen on the interface) the text box has the variable health. now i have it when the enemy shoots you u loose 10 health (out of a starting 100) and some enemies make u loose 12 health or more, what i want to do is if the dynamic health text box is >66 you have all 3 bars of life showing, if <=66 but >==34 your have 2 bars showing and <=33 but >=1 u have 1 bar of life showing, and if you r <0 it goes to a game over scene, can any1 help me with this? it is urgent,

thanks for your time,

=> Mutty!.

Is This Bad Coding?
To change the value of variable in an object class from a different object class (i.e.document class changing the stage MovieClip "Spacecraft" class) is it bad coding to do it like this...

this.getChildByName("Spacecraft")[variablename] = somevalue;

??

Also is it bad to do it this way (when not refencing from doucment class)

MovieClip(parent).getChildByName("Spacecraft")[variablename] = somevalue;
or
MovieClip(root).getChildByName("Spacecraft")[variablename] = somevalue;

??

For that matter, is MovieClip(root) and MovieClip(parent) bad coding themselves? I'm so used to AS2 and there have been a number of times I've struggled to amend variables from one object to another. Where possible I use GET and SET methods but that sometimes seems very long-winded.

AS Coding Help...
im attaching an fla here, n im hoping u guys would take a look and help me with the coding. what im trying to do is have random coins, enter the color, and then the number value.. for the next button.. you shud not b able to click it or show another coin until you get both color and value right... thanx in advanced

AS Coding Help.. IFs N More
i was wondring if any body can check my fla here, and give me an idea of how to make it work... thnx in advance

Is My Coding Right?
I'm trying to sort a small array. The problem here is that the sort function is sorting the array it's applied to PLUS another array that is just hanging out next to it. It's weird. Anyone know what's happening here?


ActionScript Code:
function sortByNumber(a, b){     return(a <  b);}sort_array = new Array();out_array = new Array();cmp_name_array = new Array();orig_array = new Array();temp_array = new Array();orig_array = [3, 5, 1, 2, 4];trace("orig_array before sort: " add orig_array);cmp_name_array = ["graph3", "graph5", "graph1", "graph2", "graph4"];temp_array = orig_array;sort_array = temp_array;trace("sort_array before sort: " add sort_array);trace("temp_array before sort: " add temp_array);sort_array.sort(sortByNumber);trace("cmp_name_array: " add cmp_name_array);trace("orig_array after sort: " add orig_array);trace("sort_array after_sort: " add sort_array);trace("temp_array after sort: " add temp_array);out_array = new Array();trace("orig_array length: " add orig_array.length);for(t=0; t< orig_array.length; t++){          temp = orig_array[t];     for(j=0; j< sort_array.length; j++)     {                    if(temp == sort_array[j])          {               out_array[j] = cmp_name_array[t];          }     }}



Here's the output for this:



orig_array before sort: 3,5,1,2,4

sort_array before sort: 3,5,1,2,4

temp_array before sort: 3,5,1,2,4

cmp_name_array: graph3,graph5,graph1,graph2,graph4

orig_array after sort: 5,4,3,2,1 //this should NOT be sorted

sort_array after_sort: 5,4,3,2,1 //this SHOULD be sorted

temp_array after sort: 5,4,3,2,1

orig_array length: 5

out_array: graph3,graph5,graph1,graph2,graph4

trace("out_array: " add out_array);

Bug Or Bad Coding?
Hi

can someone help me out with this if possible, I dont know if its a bug or just bad coding on my part, but its driving me mad!!!!

I building a math program to help kids.
one of the test I've build comes up with a intermittent error

it works by pulling five numbers from an array between 0 and 99 and then divides it by 10
then its mulitplied by either 10 or 100 (this is done by random)

the error that I am getting is that when certain number combinations come up the answer is wrong even if the user enters the correct answer

the numbers that seem to be a problem are
4.4 * 100
4.1 * 100
1.1 * 100
4.6 * 100
4.9 * 100
8.8 * 100
there could be others but these are the one I've found so far

I am stumped with this, can anyone help??

links below

http://www.fivefortymedia.com/code/decimal.fla
http://www.fivefortymedia.com/code/decimal.swf

Mp3 Coding Help
ok, i posted this in the wrong section at first. i was needing some help figuring out a method to reset variables on a list component change for my mp3 player. everytime i select a new song on the list or select the same song the timer for song position keeps going and nothing resets. here is the action script:

ActionScript Code:
var artistList:mx.controls.List;
var sound:Sound = new Sound();
info_txt.autoSize = true;
import mx.styles.CSSStyleDeclaration;
var new_style:Object = new CSSStyleDeclaration();
new_style.setStyle("fontFamily", "_sans");
new_style.setStyle("fontSize", 10);
new_style.setStyle("fontWeight", "normal");
new_style.setStyle("textDecoration", "none");
new_style.setStyle("color", 0xffffff);
new_style.setStyle("borderStyle", "solid");
new_style.setStyle("borderColor", "0x666666");
new_style.setStyle("backgroundColor", "0x000000");
new_style.setStyle("selectionDuration", 0);
new_style.setStyle("textRollOverColor", "0xff3399");
new_style.setStyle("textSelectedColor", "0x666666");
new_style.setStyle("themeColor", "0x111111");
_global.styles.myStyle = new_style;
artistList.setStyle("styleName", "myStyle");
songList.setStyle("styleName","myStyle");
var artistXML:XML = new XML();
var artists:Array = new Array();
var xmlSource = "http://home.comcast.net/~urtalkinstupid/playlist.xml";
artistXML.ignoreWhite = true;
artistXML.load(xmlSource);
artistXML.onLoad = function(success) {
if (success) {
artistNode = artistXML.firstChild.childNodes;
for (i=0; i<artistNode.length; i++) {
artistList.addItem(artistNode[i].attributes.name);
}
}
artistIndex = -1;
updatesongList(artistIndex);
};
var listener:Object = new Object();
listener.change = function(e:Object) {
if (e.target._name == "artistList") {
songList.removeAll();
artistIndex = e.target.selectedIndex;
updatesongList(artistIndex);
} else if (e.target._name == "songList") {
sound.stop();
songIndex = e.target.selectedIndex;
prepare(songIndex, artistIndex);
}
};
artistList.addEventListener("change", listener);
songList.addEventListener("change", listener);
updatesongList = function (artistIndex) {
songsNode = artistNode[artistIndex].childNodes;
for (i=0; i<songsNode.length; i++) {
songList.addItem({label:songsNode[i].attributes.name, data:songsNode[i].attributes.url});
}
};
prepare = function (songIndex, artistIndex) {
clearInterval(clock)
info_txt.text = artistNode[artistIndex].attributes.name+" - "+songsNode[songIndex].attributes.name
sound.loadSound(songsNode[songIndex].attributes.url, true);
clock = setInterval(timeInfo, 75);
};
sound.onLoad = function(){
songLength = this.duration
}
timeInfo = function(){
var totalSeconds:Number = sound.position/1000;
var percentPlayed:Number = sound.position / songLength;
var minutes:Number = Math.floor(totalSeconds/60);
var seconds = Math.floor(totalSeconds)%60;
if (seconds<10) {
seconds = "0"+seconds;
}
positionbar_mc._width = percentPlayed * 300;
timeinfo_txt.text = minutes + ":" + seconds;
}




here is a link to the file also (its too big to load).

How Do I Fix This Coding?......
how do i fix this?

right_btn.onPress = function() {
gotoAndStop(2);
};



pm me please!!!

Coding
Hi,
I have the following javascript command on my site
<a href="javascript:TabbedPanels1.showPanel(1);">Clic k Here to Switch to Tab 2</a>
It is attributed to a link which opens a spy tab.
I need to make buttons made in Flash CS3 perform the same task. Any idea of how I could do this in ActionScript?

AS Coding Help...
im attaching an fla here, n im hoping u guys would take a look and help me with the coding. what im trying to do is have random coins, enter the color, and then the number value.. for the next button.. you shud not b able to click it or show another coin until you get both color and value right... thanx in advanced

AS Coding Help.. IFs N More
i was wondring if any body can check my fla here, and give me an idea of how to make it work... thnx in advance

Coding Mc
Hey guys, just wondering, whats the coding you place on a button to load an external swf into a mocie clip on another level?

I forgot it!

Thanx!

Is My Coding Right?
I'm trying to sort a small array. The problem here is that the sort function is sorting the array it's applied to PLUS another array that is just hanging out next to it. It's weird. Anyone know what's happening here?


ActionScript Code:
function sortByNumber(a, b){     return(a <  b);}sort_array = new Array();out_array = new Array();cmp_name_array = new Array();orig_array = new Array();temp_array = new Array();orig_array = [3, 5, 1, 2, 4];trace("orig_array before sort: " add orig_array);cmp_name_array = ["graph3", "graph5", "graph1", "graph2", "graph4"];temp_array = orig_array;sort_array = temp_array;trace("sort_array before sort: " add sort_array);trace("temp_array before sort: " add temp_array);sort_array.sort(sortByNumber);trace("cmp_name_array: " add cmp_name_array);trace("orig_array after sort: " add orig_array);trace("sort_array after_sort: " add sort_array);trace("temp_array after sort: " add temp_array);out_array = new Array();trace("orig_array length: " add orig_array.length);for(t=0; t< orig_array.length; t++){          temp = orig_array[t];     for(j=0; j< sort_array.length; j++)     {                    if(temp == sort_array[j])          {               out_array[j] = cmp_name_array[t];          }     }}



Here's the output for this:



orig_array before sort: 3,5,1,2,4

sort_array before sort: 3,5,1,2,4

temp_array before sort: 3,5,1,2,4

cmp_name_array: graph3,graph5,graph1,graph2,graph4

orig_array after sort: 5,4,3,2,1 //this should NOT be sorted

sort_array after_sort: 5,4,3,2,1 //this SHOULD be sorted

temp_array after sort: 5,4,3,2,1

orig_array length: 5

out_array: graph3,graph5,graph1,graph2,graph4

trace("out_array: " add out_array);

Coding
In a flash movie, does adding more coding(ie. a lot of actionscript code like "if then" statements, variables, expressions etc.)

increase movie size?

or does adding scripting not affect movie size?

if anyone knows...please let me know.



Help With Coding. Thanks
Can anyone teach me or share the coding like the one in the website below? i mean the pictures which can see 360% degree

http://www.sydneyoperahouse.com/sect...ur/vrtour2.asp

Thanks... i need that in my project..

Coding Help Please
I recently started working with classes and tried to make my own.

After following a butt-load of tutorials and books - I made a navigation class that disables a button when clicked on it and when you click on another button it enables the previously disabled button.

anywho, my problem is... i wanted to write some code that disables the first button when the project loads - basically status indication for the homepage.

{i would think the code would go like:

on enterframe disable first button, if any other button is clicked then disable listener}

no idea... please help

A Tad Of Coding Help Please
stop()

number = Math.round(Math.random()*10)

if (number = <6) {
gotoAndPlay (2)
}
else {gotoAndPlay (3)
}



Why does this automattically skip to frame 2? Why won't it work? Please help.

Help In Yugo Pop Coding
Hi,
I've posted a couple of times now but no one seems to ... be reading it... [so the exclamation icon]

Okay... i have a movie in which i have a Yugo menu. It's implemented into the movie but i can't seem to actionscript it so that the buttons actually work. I'd appreciate it VEEERY much if some one helps me out here... you'll see my site at: http://www.ece.utexas.edu/~shasan
From there find the menu (a tab that glows next to the title... maximise it, drag it)...
Go to pictures... you'll see the Yugo Pop menu.
Now... i cannot implement it so that this button loads up another screen, frame, movie container...

i need hElP!
either i could email you the file or else you can take it from my site... (i'd prefer the email methond... that allows us to keep in touch too...)
my email is, "coolsun_82@hotmail.com" ... pUleaSe help...

Shams

Button Coding
I'm trying to have a single button on release make one movie clip "disappear" from the stage and another movie clip start playing....I think I need some coding experience??
Help Please

Coding Clarification
Hello all,

I was wondering what the following meant:


Code:
/:selection = ../:_name;


Isn't this just telling the movieclip 'selection' to be equal to the previous mc called name? I guess what is confusing me is the slashes. I'm used to writting code with _root and _parent and seem to get confused when trying to learn from code like this.

Thanks for your time,

Button Coding
I want to be make a button play a Mp3 and another Button to stop it from playing. Maybe after I get that down I can make the same button do both?? ....Thanks

I know how to name the Mp3 in the Library.. (Linkage)

HTML Coding?
Once I've finished creating a movie, what is the coding to use to have it appear on my web page? I'm experienced with HTML, but I've never dealt with Flash. Also, what is the difference between swf files and fla files?

Coding Curves
hey i am trying to simulate a branch shooting off of a main object, however i want to make the branch fluctuate/vibrate over time. i was wondering if there was anyway of manipulating lines in code to simulate curves. and help or pointers to tutorials would be helpful.

PS: i am not talking about a shape tween which will continuously loop but rather a coded line which i can manipulate

thanx and be well

Some Funky Coding
i'm just starting to get into scripting so i was doing this tutorial out of a book, and i got this coding out that doesnt seem to do anything. i'm pretty sure it's supposed to make some kind of text effect, but it's not looking too good. if i send someone the fla could you do a proofread of sorts with it? cause i worked on it for hours and got no where

Copyright © 2005-08 www.BigResource.com, All rights reserved