Movement Element Tutorial Needed
i need to know how to make a person jump, come back down, move left and right, make borders and do stuff like punch and shoot
FlashKit > Flash Help > Flash ActionScript
Posted on: 03-08-2004, 10:49 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Mouse-movement Triggers Background Movement - Help Me Find Tutorial
I want to learn how to make an image react on my mouse-movement, so you get the effect as if you're looking around. You move the mouse to the right, and the image on the screen moves to the right, etc. I've seen an example of that on http://www.center-of-the-world.com/ - but I don't know how to find a tutorial for that on the Flashkit-site. Can anyone help?
Help Needed: Stopping Last Element In Array Incriment
Hello,
I've got code that takes text from an array and places it into a textbox. The first spot in the array is supposed to be null to correspond with the first section of the swf which shouldn't have any text. But after navigating through the different array elements the movie gets confused and doesn't recognize that the first slot should be empty and shifts things out of order.
What seems to be happening is when you are clicking the buttons to go to the sections there is a variable that is either incrimented or decrimented so that it can be used as the index for the array. It would seem that this variable is not being kept track of properly, as when you are at the end of the Array and there is no more sections you can still press the button that would incriment this variable and thus move to an element in the array that isn't there (being array.length + 1 or -1 depending). so what is needed is some sort of condition that checks to see if this variable is infact at the last element in the array and if so not to incriment itself.
Here is the array code. This code is part of a loaded external movie.
ActionScript Code:
portfolioSection([" ", "section 02", "section 03", "section 04"]);
And this code is in the main movie that talks to the array in the external file.
ActionScript Code:
var aSectionTxt;var iSectionIndex = 0;_global.portfolioSection = function (a) { targetX = 527; path = _root.sectionMC_03.folioClip maxWidth = path.section_mc._width-529; velocity = 4; aSectionTxt = a.concat(); path.section_mc.initEnterFrame(); path.forward_btn.onRelease = function() { if (targetX>-(maxWidth-370)) { targetX -= 370; path.section_mc.initEnterFrame(1); } }; path.back_btn.onRelease = function() { if (targetX<527) { targetX += 370; path.section_mc.initEnterFrame(-1); } };};MovieClip.prototype.initEnterFrame = function(dir) { path.section_txt.text = ""; if (mcMovieToRemove != null) { removeMovieClip(mcMovieToRemove); } this.onEnterFrame = function() { trace("Running Enter Frame"); this._x += (targetX-this._x)/velocity; if (this._x<<img src="images/smilies/frustrated.gif" border="0" alt="">targetX+1) && this._x><img src="images/smilies/frustrated.gif" border="0" alt="">targetX-1)) { trace("Stopping Enter Frame"); this._x = targetX; setSectionText(dir); delete this.onEnterFrame; } };};_global.setSectionText = function (dir) { if (dir != undefined) { iSectionIndex += dir; } if (typeof (aSectionTxt[iSectionIndex]) == "string") { path.section_txt.text = aSectionTxt[iSectionIndex]; } else { mcMovieToRemove = path.attachMovie(aSectionTxt[iSectionIndex].linkage, "mcSectionMovie", 10); mcMovieToRemove._x = aSectionTxt[iSectionIndex].x; mcMovieToRemove._y = aSectionTxt[iSectionIndex].y; }};
I've been struggling with this for some time now, and had previously posted a thread about this earlier on but it's since been deleted because there have been no responses and I wanted to try to present the problem a little clearer. Your help would be greatly appreciated. Thanks.
Help Needed: Stopping Last Element In Array Incriment
Hello,
I've got code that takes text from an array and places it into a textbox. The first spot in the array is supposed to be null to correspond with the first section of the swf which shouldn't have any text. But after navigating through the different array elements the movie gets confused and doesn't recognize that the first slot should be empty and shifts things out of order.
What seems to be happening is when you are clicking the buttons to go to the sections there is a variable that is either incrimented or decrimented so that it can be used as the index for the array. It would seem that this variable is not being kept track of properly, as when you are at the end of the Array and there is no more sections you can still press the button that would incriment this variable and thus move to an element in the array that isn't there (being array.length + 1 or -1 depending). so what is needed is some sort of condition that checks to see if this variable is infact at the last element in the array and if so not to incriment itself.
Here is the array code. This code is part of a loaded external movie.
ActionScript Code:
portfolioSection([" ", "section 02", "section 03", "section 04"]);
And this code is in the main movie that talks to the array in the external file.
ActionScript Code:
var aSectionTxt;var iSectionIndex = 0;_global.portfolioSection = function (a) { targetX = 527; path = _root.sectionMC_03.folioClip maxWidth = path.section_mc._width-529; velocity = 4; aSectionTxt = a.concat(); path.section_mc.initEnterFrame(); path.forward_btn.onRelease = function() { if (targetX>-(maxWidth-370)) { targetX -= 370; path.section_mc.initEnterFrame(1); } }; path.back_btn.onRelease = function() { if (targetX<527) { targetX += 370; path.section_mc.initEnterFrame(-1); } };};MovieClip.prototype.initEnterFrame = function(dir) { path.section_txt.text = ""; if (mcMovieToRemove != null) { removeMovieClip(mcMovieToRemove); } this.onEnterFrame = function() { trace("Running Enter Frame"); this._x += (targetX-this._x)/velocity; if (this._x<<img src="images/smilies/frustrated.gif" border="0" alt="">targetX+1) && this._x><img src="images/smilies/frustrated.gif" border="0" alt="">targetX-1)) { trace("Stopping Enter Frame"); this._x = targetX; setSectionText(dir); delete this.onEnterFrame; } };};_global.setSectionText = function (dir) { if (dir != undefined) { iSectionIndex += dir; } if (typeof (aSectionTxt[iSectionIndex]) == "string") { path.section_txt.text = aSectionTxt[iSectionIndex]; } else { mcMovieToRemove = path.attachMovie(aSectionTxt[iSectionIndex].linkage, "mcSectionMovie", 10); mcMovieToRemove._x = aSectionTxt[iSectionIndex].x; mcMovieToRemove._y = aSectionTxt[iSectionIndex].y; }};
I've been struggling with this for some time now, and had previously posted a thread about this earlier on but it's since been deleted because there have been no responses and I wanted to try to present the problem a little clearer. Your help would be greatly appreciated. Thanks.
Spry Horizontal Navigation Element Covers Flash Element...
i have a spry navigation bar with a flash movie underneath, and when i hover over the navbar and the submenu pops down it covers the flash movie, but it doesn't cover the .jpg image that is next to the flash movie. how can i fix this? thanks.
Help Needed With AS Movement
Hi all, over the past few days I've been trying to get to grips with movement in AS and there seems to be a veritable feast of information out there regarding it. I've had a lot of help from various people on these boards and I want to say 'thanks' to all those who've helped me out.
BUT - If I could indulge upon your good natures again...
I've put together a small piece utilising various bits of code that I've gained from helpful posts in which buttons move an instance around the stage on the X&Y axis but I don't know how to constrain the instance to the stage. Could anyone help me?
I've attached an FLA.
Need A Tutorial On Movement.
I wish to create a banner that loads images at random into it. Will fit 13 or so images in the banner. I need the images to move from right to left, one after the other and continuosly keep loading a different image from the library. I have 30 images in total I would like to load into the banner. Does anyone know of a tutorial on how to do this???
Thanks.
Actionscript Needed For Movement
Hi guys, (sorry bit of an ambiguious title there)
just a quick one. im creating a site for a friend. He wants the site to load with a lot of movement- you know panels flying in from all over the place, text typing itself etc.
The question is i was going to use a combination of motion tweening and animated masks for the job. Is this the best way to achieve this type of effect?
Is there a better way using actionscript?
(and) using lots of tweens slow the file down?
thanks for your help
Stop Movement Needed
hi guys, i need some help with this movie... itas a word falling, but i need that the word stop moving when i make a rollover on it and in the rollout make the word continue with the falling, the fla file its attached , and hope you guys can help me... thnax in advanced!
Help With Continuous Movement Tutorial
Hi,
Sorry for the rookie question, but I tried the continuous movement tutorial and still had a problem. My animation does not loop...ie the circles move off screen...I see a small transition..and then nothing. I have tried previewing this animation with "loop" on and off with no luck.
Can anyone explain what I'm missing?
Thank you
Continious Movement Tutorial Help
Hello, i have a small probly reeli stupid question, about the creating continous movement tutorial http://www.kirupa.com/developer/mx/c...usmovement.htm
i was wondering wat do i do to make it so the size and speed of the objects that are moving, to not be coninsiding with the movement of your mouse
or wat is a good setting for a scene of 1004x130 . so the objects dun go to fast and arnt to big
thnx for the help...i hope haha
Beginner --- Movement Tutorial
I downloaded xmovement.fla --- copied and pasted onClipEvent script and got a message I have got before. It reads
**Error** Scene=Scene 1, layer=object, frame=1:Line 8: Clip events are permitted only for movie clip instances
onClipEvent(enterFrame) {
Total ActionScript Errors: 1 Reported Errors: 1
Would someone explain where what this means --- the blue box is a movie clip, i believe.
Continuous Movement Tutorial
I played around with the "continuous movement" tutorial for along time and was facinated by it! I fiddled w/ the code for awhile and i came up with something that i thought just maybe someone would be interested in.
first off, i got the motion to work in both directions. In doing so, i found another way to "respawn" the points to create a smoother field of dots.
instead of this line:
this._x = -1000
(which respawns the dot far from its ORIGINAL position) try this:
this._x = location - (size of movie + 20)
if you are interested here is the code that moves both ways based on a movie clip in the center called "center", try using this modified version of the code in the tutorial:
onClipEvent (enterFrame) {
location = this._x;
var i;
i = _root.center._xmouse/10;
if (i>0){
if (this, hitTest(_root.block)) {
this._x = location-400;
} else {
this._x = location+i;
}
}
if (i<0){
if (this, hitTest(_root.block2)) {
this._x = location+400;
} else {
this._x = location+i;
}
}
}
I'm a total newb, but i learned alot from just playing around w/ that tutorial. Thanks for the great site!
Continuous Movement Tutorial
Concerning the continuous movement tutorial, i was wondering in the actionscript whether or not there was a way to make it so that the circles are always the same size and move at the same speed and cannot be changed by moving the mouse around.
I read the page on what each line of the actionscript says, but I am not literate enough with it yet to know what I should, or even if it is possible to, change.
Thanks,
Steve
Help With Continuous Movement Tutorial
Hi,
Sorry for the rookie question, but I tried the continuous movement tutorial and still had a problem. My animation does not loop...ie the circles move off screen...I see a small transition..and then nothing. I have tried previewing this animation with "loop" on and off with no luck.
Can anyone explain what I'm missing?
Thank you
Continious Movement Tutorial Help
Hello, i have a small probly reeli stupid question, about the creating continous movement tutorial http://www.kirupa.com/developer/mx/c...usmovement.htm
i was wondering wat do i do to make it so the size and speed of the objects that are moving, to not be coninsiding with the movement of your mouse
or wat is a good setting for a scene of 1004x130 . so the objects dun go to fast and arnt to big
thnx for the help...i hope haha
Mouse Movement Tutorial
hi guys! does anyone know where can i find a tutorial about how to make a lot of mc's be "scared" of the mouse?? kind of movin oppsite of the mouse when it gets close to them, but just a little...
tahnks in advance
Random Movement Tutorial
hi, i found this tutorial;
http://www.kirupa.com/developer/mx/random_motionMX.htm
and am wondering how i could tween the graphic symbol such that it appears it is "travelling" to the next random location (instead of just having it suddenly appear at the next random (x,y) coordinate).
Movement, Bounce, And Zooming. Help Needed
hello i want to do an effect like the one used in this site: http://www.yrmis.com/site.html
anyone can help me?
i only talking about the effect of the girls on the bottom..
in this case the images are only horizontal but in my case i'd like to put like 3 lines with logos..
if it's impossible or too hard no problem at least someone help with the horizontal.
Thanks in advance
Hiding An Element If Another Element Is Undefined
Hey all, I have another issue...
Basically I have 14 text boxes, each box draws its content from an external txt file. Next to each text box is a button. I want the button to be either visible=true or visible=false depending on weather or not the text box has content or is "undefined" Here is what I have so far, and it's not working:
Code:
loadText = new LoadVars();
loadText.load(cat1+"_"+cat2+"_"+cat3+"_"+cat4+"_products.txt");
loadText.onLoad = function() {
product1.text = this.product1;
product2.text = this.product2;
product3.text = this.product3;
product4.text = this.product4;
product5.text = this.product5;
product6.text = this.product6;
product7.text = this.product7;
product8.text = this.product8;
product9.text = this.product9;
product10.text = this.product10;
product11.text = this.product11;
product12.text = this.product12;
product13.text = this.product13;
product14.text = this.product14;
};
for (x=1, x<14, x++){
if (this.product+x == undefined) {
this.send+x+_btn._visible = false;
} else {
this.send+x+_btn._visble = true;
}
}
So as you can see, I would like a FOR loop to just run through the variables and check to see if any of them are undefined. if it is, then make the correct send button invisible.
any ideas?
Movement Using Keyboard Keys Tutorial Help
Hey...i did this tutorial and i did exactly what it said...but in the tutorial it shows the lady bug actually roatating...but when i follow the steps and test it..it doesn't rotate
can anyone test this out and see for themself?
Question About The Random Movement Tutorial
hi! this tutorial has been great, hold on i'll link to it so you know what i'm talking about...
http://www.kirupa.com/developer/mx/random_motionMX.htm
so, yeah - i am using it on fireflies and they are buzzing about very nicely... but one little question. when the movie loads up they kinda pause a second before starting their motion. is there a way around this pause? anything in the code i could change to get rid of it?
any help would be appreciated
thanks!
emma.
Question On Random Movement Tutorial
I followed the tutorial and my animation is the logo at fazal.tk. I set the boundaries to the size of the movie but the mcs still sometimes still go partially of the movie.
Movement Using Keyboard Keys Tutorial Help
Hey...i did this tutorial and i did exactly what it said...but in the tutorial it shows the lady bug actually roatating...but when i follow the steps and test it..it doesn't rotate
can anyone test this out and see for themself?
Help Needed With This Tutorial
Hi i have been reading over this tutorial @
http://www.virtual-fx.net/tutorials/html/lazer.htm
and @ STEP 2, No:4 it`s telling me 2 goto Window > Inspectors > Object.
the trouble i am haven is i cant find the "INSPECTORS" in the window menu on the interface can any 1 point me in the right direction ?
thanx 4 taken the time 2 read this post
=)
Tutorial Needed
hi all!
i need to find a tutorial on how to let users load external *.jpg's
into a *.swf file.
thanx for any help
Tutorial Needed
Does anybody know where I can find a tutorial to create a photo gallery like the one within this site? Or...How do I add this action to a button? Please be specific about steps.
http://www.samsarkisphotography.com/flash/index.html
I will appreciate all help.
A Tutorial Needed For...
I searched the net and found plenty of as2 tutorials for making a car racing game but none for as3??
anyone know of any good tutorials of such??
thank you
Tutorial Needed
hi all!
i was wondering if there is a good tutroial here in kirupa or another site on how to make a music player in your site... like u know it displays the song name and has stop, play, next buttons..
a link to somewhere will be very nice
thank you
Tutorial Needed In This.....
Hello! Can anyone give me a tutorial in making the jumping thingy when you play a sound? Like in this website.
http://www.flashkit.com/loops/Easy_L.../Instrumental/
Thanks in advance
Tutorial Needed
i'd like to learn how to make a visualization like winamp, i don't know the name of those bars that move as fast as the sound plays, but i think you know what i mean. if any of you can help find a tutorial i would really appreciate it.
Falling Snow Tutorial (on This Site) - Horiz Movement Question
I just followed your fabulous falling snow demo. It is quite beautiful and relaxing to watch. My only problem was that in my version, the snow was falling straight down, not meandering side to side. The .fla download works fine. I followed directions exactly, then compared my version with the downloaded one. I noticed in the downloaded version there is a separate layer for action, which I included and moved the actionscript but it did not fix the problem. Has anyone else done this tutorial or have any advice on this? At first I thought it was because I was using CS3 but then the downloaded file works fine so that's not it.
Thanks,
Matt
Controlpane, Tutorial Or Help Needed
I'm preparing a site with technical data for various products, but sometime the number of columns in a table is too big that I've decided to draw it in .jpeg, convert it in a movieclip and let it scroll orizzontally in a controlpane. problem is, I don't know how to use it; the help of flash is a little too generic and I really don't understand how does it works; all I know is that only movieclips can scroll inside a controlpane, but how can I put my clip inside it? any help is hugely appreciated!
Preloader Tutorial Needed
can anyone here give me a good place for a bar preloader. i would like to add a bar preloader to my origonal comunicative preloader but i cant find the tut.
Preloader Tutorial Needed
can anyone here give me a good place for a bar preloader. i would like to add a bar preloader to my origonal comunicative preloader but i cant find the tut.
Flash 8 Tutorial Needed
Ok, heres the deal.
There's a community project happening on a message board that I am a regular at, and a sort of birthday card is being made for a member. People can come and contribute art and stuff to go on this big picture, and it was suggested that writers should be able to contribute their stuff too. But of course, writers can't just throw their pieces all over this picture. I thought that I could contribute by turning this picture into an interactive flash thingy, and put little bits of paper over the room and make them clickable so you can zoom in and read them.
I have Flash 8, but really, I don't know the first thing about it. So lets just say I'd have the main image, and probably the wee bits of paper in separate layers.
Where would I go from here?
Help Needed On Kirupa Tutorial Re: XML
on the following Link http://www.kirupa.com/developer/flas...ml_as3_pg6.htm
in the section "Filtering Attribute Information"
Kirupa takes you through filtering by the ISBN number, these results include the XML tags as well could anybody advise me how i would eliminate them in this section:
function ParseBooks(bookInput:XML):void {
trace("XML Output");
trace("------------------------");
var authorList:XMLList = bookInput.Book.(@ISBN == "0743203178");
trace(authorList);
}
i beleive its using the .text(); function but i can't find where to put it.
also, in order to load this information into a dynamic text box do i just replace trace with the destination of my text box?
Thanks
Daniel Hodkinson
Slideshow Tutorial Needed - CS3 / AS2
Hey All... I've never built an XML slideshow before and my client wants something that functions very much like:
http://www.marc-cain.com
I'm no newbie... but as i've not touched XML slideshows before I was hoping someone could point me in the direction of the best tutorial... it would save me a few days head-scratchin' !!
Cheers for any help people...
Jimmy
Help Needed On Intemed Tutorial 58
Working on Int Tutorial numero 58 Dynamic Menu w Subs
Everything is working EXCEPT cant seem to figure out how to code a menu button which does not have any submenus
ie The first button I made was the Home button it has no sub menus I want it to get Url when released.... have tried numerous approaches (I new to actionscript and programming)
nothing works
Any help will be greatly appreciated...
thanks
FLAP Tutorial Needed
Anyone know where I can find a good tutorial on using the FLAP, Flash Remoting in PERL. I'm new to flash remoting, but not to PERL, and really don't want to learn PHP yet. There seems to be alot out there for the AMF-PHP version, but every link I find for AMF-PERL brings me back to the site where I downloaded it in the first place, http://www.simonf.com/flap/, and those tutorials although useful are not so complete.
I appreciate any direction anyone out there could give me.
Thanks,
Steve
Masking Tutorial Help Needed
I'm attempting to do a moving mask. I have got a mask and a masked layer. I have got the mask layer to move. Everything is good, and it even plays, but when I go to test all I get is a totally blank screen. Why is that?
How To Fire Tutorial Help Needed
Hi Everyone, I'm new to the forums!
I'm having an issue with the 'How to Fire' tutorial on Kirupa. I have quadruple checked my syntax and all that but I can't find the reason for the problem.
I only seem to be able to fire one bullet at a time, when I fire another, the first one disappears. I've attached my FLA to look at.
The movement/fire actions are on the plane, the bullet actions are well..... on the bullet!
Thanks in advance for any help!
HELP NEEDED PLZ About Grass Tutorial
hey, well i've followed the grass tutorial in special effects on kirupa.com. it all works fine and well BUT the trouble i have is i want to stop the grass movie clip after a certain frame, because its in scene 2 of my cartoon and jsut continues. the mc only uses frame 1 of my scene 2 but how would i go about stopping it?
Masking Tutorial Help Needed
I'm attempting to do a moving mask. I have got a mask and a masked layer. I have got the mask layer to move. Everything is good, and it even plays, but when I go to test all I get is a totally blank screen. Why is that?
Flash Tutorial Needed
hey guys,
need some help.
If you check out:
Code:
www.eliteclubbing.com
You will see a a scrolling GIF under the Newsletter heading. But as you can see from this the animation is quite poor plus I would like it to loop without any jumps or pauses that you get with GIF.
I was just wandering if there any tutorials I can look?!
Never really used Flash so be gentle!
Thanks
Help Executing A Tutorial Needed
I've been trying to follow this tutorial (http://www.lashf.com/page/basic/running_circles_effect), but as I'm new to Flash I'm having some problems. I think it's because in action script 3 you can't ad an actionscript to a movieclip? Is this correct? and if so how do I get around that?
I've figured out how to get the circle to move and fade, it's just the rest of it that doesn't seem to work.
Any help would be appreciated. (I have Flash CS3)
Flash 8 Mp3 Tutorial Help Needed
So this is the code i copied from the video
Code:
// Setup sound object
var s:Sound= new Sound();
s.onSoundComplete=playSong;
s.setVolume(75);
// Array of songs
var sa:Array=new Array();
// Currently playing song
var cps:Number =-1;
// Load the songs XML
var xml:XML= new XML();
xml.ignoreWhite= true;
xml.onLoad= function()
{
var nodes:Array= this.firstChild.childNodes;
for(var i=0;i<nodes.length;i++)
{
sa.push(nodes[i].attributes.url);
}
playSong();
}
xml.load("songs.xml");
// Play the mp3 File
function playSong():Void
{
if(cps==sa.length- 1)
{
cps= 0;
s.loadSound(sa[cps].true);
}
else
{
s.loadSound(sa[++cps]. true);
}
}
But i get
Error opening URL "file:///C|/Documents%20and%20Settings/Desktop/Mp3%20Player%201/undefined"
Error opening URL "file:///C|/Documents%20and%20Settings/Desktop/Mp3%20Player%201/songs.xml"
when i try to run it,
So i tried this
Code:
// create a Sound object
var mySound:Sound = new Sound();
// when a song is finished call playbeat function
mySound.onSoundComplete = playbeat;
// set initial volume to 75%
mySound.setVolume(75);
// create array of all beats..
var beatArray:Array = new Array();
// counter to current beat.
var nowBeat:Number = -1;
// create xml object
var xml:XML = new XML();
xml.ignoreWhite = true;
// load xml
xml.onLoad = function(){
var nodes:Array = this.firstChild.childNodes;
// iterate through array - push into beatArray
for(var i=0;i<nodes.length;i++){
beatArray.push(nodes[i].attributes.url);
}
playbeat();
}
// tell it to load in xml file
xml.load("songs.xml");
// play beats
function playbeat(){
// check which song is playing
// if at end, play first one
if( nowBeat == beatArray.length-1){
nowBeat = 0;
mySound.loadSound(beatArray[nowBeat], true);
}
else {
mySound.loadSound(beatArray[++nowBeat], true);
}
}
And it worked fine, but i need the original code i tried to work as it relates
to the second part of the tutorial
If anyone could help me out i would apreciate it
Thanks
|