Basic Catch Game With Slider
Hi EverybodyI am trying to create a catch game with a slider running across the bottom.This is my basic first attempt.I attach movies from the library and there is nothing on the main stage.It seemed to be working fine until I added the script to move the slider with the mouse rather than moving it by clicking on the keyboard. Now, it crashes and I get a message saying that a script is causing the movii to run slowly in Flash Player. Here is the script: var depth = 0;allBalls = new Array();function makeNewClip() {clearInterval(ranID);ran = (Math.random()*3000)+1000;ranID = setInterval(makeNewClip, ran);newClip = _root.attachMovie('circle', 'circle'+depth, depth++);allBalls.push(newClip);trace(allBalls);newClip._x = Math.random()*Stage.width;newClip._y = -50;newClip.speed = (Math.random()*10)+5;newClip.onEnterFrame = function() {this._y += this.cyflymder;};}makeNewClip(); _root.attachMovie('slider', 'slider_mc', -1);slider_mc._y = Stage.height-20;slider_mc.onMouseMove = function() {this._x = _xmouse;//updateAfterEvent();};Mouse.hide(); _root.createEmptyMovieClip('watchCollision', -2);watchCollision.onEnterFrame = function() {for (i=0; 1<allBalls.length; i++) {if (allBalls[i].hitTest(slider_mc)) {trace("hit slider");allBalls[i].removeMovieClip();allBalls.splice(i, 1);}}}; I would be grateful for any help/ideas. Thanks a million
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 10-11-2005, 10:22 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Basic Catch Game Using A Slider
Hi Everybody
I am trying to create a catch game with a slider running across the bottom that catches the falling objects.
This is my basic first attempt.
I attach movies from the library and there is nothing on the main stage.
It seemed to be working fine until I added the script to move the slider with the mouse rather than moving it by clicking on the keyboard. Now, it crashes and I get a message saying that a script is causing the movii to run slowly in Flash Player.
Here is the script:
//This script is the ramdom generator for the falling objects//
var depth = 0;
allBalls = new Array();
function makeNewClip() {
clearInterval(ranID);
ran = (Math.random()*3000)+1000;
ranID = setInterval(makeNewClip, ran);
newClip = _root.attachMovie('circle', 'circle'+depth, depth++);
allBalls.push(newClip);
trace(allBalls);
newClip._x = Math.random()*Stage.width;
newClip._y = -50;
newClip.speed = (Math.random()*10)+5;
newClip.onEnterFrame = function() {
this._y += this.cyflymder;
};
}
makeNewClip();
//this script is for sliding the slider along the bottom of the screen//
_root.attachMovie('slider', 'slider_mc', -1);
slider_mc._y = Stage.height-20;
slider_mc.onMouseMove = function() {
this._x = _xmouse;
//updateAfterEvent();
};
Mouse.hide();
//this script detects the collision of the falling objects with the slider//
_root.createEmptyMovieClip('watchCollision', -2);
watchCollision.onEnterFrame = function() {
for (i=0; 1<allBalls.length; i++) {
if (allBalls[i].hitTest(slider_mc)) {
trace("hit slider");
allBalls[i].removeMovieClip();
allBalls.splice(i, 1);
}
}
};
I would be grateful for any help/ideas.
Thanks a million
Catch Game Problem Using HitArea
Hi, i've been messing around trying to make a simple catch game. I have a character (jelly_mc) who can move left and right and when movie clips fall (astro1_mc) he has to catch them (sort of). I've been using 'hitArea' to determine when the falling object (astro1_mc) hits the character and when it does it adds 1 to the score.
However, my score often jumps by more than 1 as the astro1_mc passes through. Can anyone help. heres my code:
Code:
score=0
this.jelly_mc.onEnterFrame= function () {
//Makes Jelly Monster go Right when the RIGHT arrow is pressed
if(Key.isDown(Key.RIGHT)) {
jelly_mc._xscale = Math.abs(jelly_mc._xscale);
jelly_mc.nextFrame();
jelly_mc._x +=10;
}
//Makes Jelly Monster go Left when the LEFT arrow is pressed
if(Key.isDown(Key.LEFT)) {
jelly_mc._xscale = -Math.abs(jelly_mc._xscale);
jelly_mc.nextFrame();
jelly_mc._x -=10;
}
}
// Checks to see whether falling object hits the character
this.astro1_mc.onEnterFrame =function () {
if (this.hitTest(jelly_mc._x, jelly_mc._y -50, true)) {
score +=1;
astro1_mc._visible=false;
}
}
Finally, I'm all self taught at this and have been putting all my actions in a seperate layer on the main timeline. is this the best practice ?????
thanks in advance
Andy
[CS3] Flash Catch Game, AS Code Need To Be Adapted, Can Anyone Advise?
I am creating a catch game where basically there is a falling object and a slider to catch the object using the keyboard to control left and right movements. I have a few questions and I wonder if you might be able to advise me how to adapt the script below? It would be appreciated if anyone can help. Sorry to ask a few questions.
I'll ask the questions first then post the script below for you to see how it is:
Q1. I have found actionscript code that I like for the movement of the slider but it currently has to sit onClipEvent (load) to work, i was wondering if you know how to incorporate that script back on to the timeline and if it is sensible to do this? This Script is also posted below.
Q2. For some reason the slider (called 'cocktail' in the code) now sits below the falling object (movieclip 'good') and the movieclip gets removed when the top of 'good' hits the 'cocktail', it is what I want becuase it needs to fall into the glass, but it is visible above the glass until the top is in, it needs to be at a depth lower than the glass I think so it's blocked out of view?
Q3. I want to add a second falling clip called 'bad' but I want this to fall at a different rate to 'good' perhaps 1 of bad to every 10 of good. I want the score of bad to be different and to be able to adjust the frequency of the fall as levels progress.
I am looking to have scores as: 'good' falling of stage= -2, 'bad' falling off stage= 10, 'good' falling in glass (a catch)= 5, 'bad' falling in glass= -30
Also, how can I say if the score goes in to a negative/minus figure below 0 that it needs to remain at 0 and not go to -10 for example.
Q4. I want to trigger the falling movieclips to play themselves when hittest the ground (say 10 pixels up from bottom of the screen to explode just before they leave the screen) Any ideas? In the falling clip I can put 'stop' on first frame and animate the explosion from frame 2 onwards once I ca get it to trigger the play of MC correctly.
Q5. Finally, the slider 'cocktail' actionscript(currently on the movieclip) has a nice friction slow down etc so when moving right and suddenly pressing left it would be great to get the glass to very slightly rotate on it's bottom right corner maybe only 10 or 15 degrees but enough to give the glass a shor tilt before it returns back to no rotation, then mirror this effect to do the same when going the other way.
I'm sorry again that there are so many questions but if you can help with even one or two I would be extremely grateful.
Thanks
Below is the actionscript:
Terry
_____________________
Actionscript on Fr 1 On main _root timeline:
//this produces random balls that fall from the sky
depth = 0;
allBalls = new Array();
function makeNewClip() {
clearInterval(ranID);
ran = (Math.random()*250)+500;
ranID = setInterval(makeNewClip, ran);
newClip = _root.attachMovie('good', 'good'+depth, depth++);
allBalls.push(newClip);
//trace(allBalls);
newClip._x = 140 + Math.random()* 430;
newClip._y = -50;
newClip.speed = (Math.random()*5)+5;
newClip.onEnterFrame = function() {
this._y += this.speed;
if (this._y>Stage.height) {
updateScore(-2);
for (i=0; i<allBalls.length; i++) {
if (this == allBalls[i]) {
allBalls.splice(i, 1);
//trace(allBalls)
}
}
this.removeMovieClip();
}
};
}
//
makeNewClip();
//
//
_root.createEmptyMovieClip('watchCollision', -2);
watchCollision.onEnterFrame = function() {
for (i=0; i<allBalls.length; i++) {
if (allBalls[i].hitTest(cocktail_mc._x, cocktail_mc._y, true)) {
//trace('we hit the cocktail');
allBalls[i].removeMovieClip();
allBalls.splice(i, 1);
updateScore(5);
}
}
};
score = 0;
function updateScore(amount) {
score += amount;
score_txt.text = 'Score is '+score;
}
updateScore(0);
//Actionscript on slider MC, my slider MC is called 'cocktail':
onClipEvent (load) {
power = 0.5;
yspeed = 0;
xspeed = 10;
friction = 0.95;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
xspeed -= power;
}
if (Key.isDown(Key.RIGHT)) {
xspeed += power;
}
xspeed *= friction;
yspeed *= friction;
_y += yspeed;
_x += xspeed;
}
XML Slider - Basic
Hi Everyone,
I've spent the past few days tinkering with XML and attachmovie etc...
Kirupa's Gallery is a great start but I needed something different.
This Gallery Parses an XML file which includes:
- Caption
- Image URL
- Image Width
The Gallery currently:
- Loads each image consecutively
- Loads each caption into a stylized movieclip
- Contains two buttons, each which slide the 'Container' movieclip in either direction(hard coded) using the MC Tween Class. Grab that class if you dont have it already installed. Its similar to the Laco tween.
What I have works great, but I need some help extending it.
I would like to:
- Create a function that slides the 'Container' clip in either direction using an incremental value that slides to the next (or previous) image in the array. If you are at the last image the 'Container' will then slide back to the first.
- The width is defined in the XML file, though it would be great if it could be found dynamically rather than hard coded.
Any help or tips to extend this would be greatly appreciated.
I have attached a .zip file of both the .fla (flash 8) and xml as well as each file separately.
Thanks!
Hope all is well.
// Matt
Heres the initial AS if you don't want to grab the files right away:
Code:
//Include MC Tween Class
#include "mc_tween2.as"
//XML Action...
importXML = new XML();
importXML.ignoreWhite = true;
importXML.onLoad = function(success)
{
if (success)
{
var depth = 5;
var nextX = 0;
count = 0;
_root.createEmptyMovieClip("container",2);
var root = this.firstChild; // The root node
for (var i = root.firstChild; i != null; i = i.nextSibling)
{
var tempMC = _root.container.attachMovie ("box", "box" + count, depth ++, {_x : (nextX) , _y : (15)} );
nextX+= tempMC._width + Number(i.attributes.width) + 20;
tempMC.caption.name_txt.text = i.attributes.name;
tempMC.holder.loadMovie(i.attributes.image, depth*20);
count ++;
}
}
}
importXML.load("xml_slider.xml");
//Movie Clip Button Functions
//Show More Images
more.onRelease = function() {
container.tween('_x', -1000, .5, 'easeoutquad');
}
//Show More Images
less.onRelease = function() {
container.tween('_x', 0, .5, 'easeoutquad');
}
Need Some Basic Game Help
I'm trying to create a game similar to the famous "Dis Or Dat" that is featured daily at YDKJ.com. Basically, I'm trying to set it up so that users press a number on their keyboards (1, 2, 3, or 4) that corresponds to what they think the answer is. If they select the correct answer, they get 10 points. If they select the wrong one, 10 get taken away.
I can't find anything on the "free" scripting sites that shows something like this. Any ideas on where to go?
Thanks.
Pong Game - Move Slider
Hi
I'm adapting a pong flash game.
I'm having trouble moving a slider that controls the speed that the ball travels at - as soon as I move the slider (to the bottom
of the game rather than the current right hand position) - and update the startDrag coordinates - the computer's pong racket movement
becomes erratic.
You can see the demo game here: http://www.dirksmith.com/pong/pongTest.html
Grateful for any help.
.fla attached
Dirk
The scripts are:
slider actionscript on main timeline
onClipEvent (enterFrame) {
/:drag = Math.round(_root.diff._y - this._y)/ -10 ;
slider mc actionscript:
on (press) {
startDrag(_root.setter, false, 26, 65, 26, 140);
}
on (release) {
stopDrag();
Pong Game - Move Slider
Hi
I'm adapting a pong flash game.
I'm having trouble moving a slider that controls the speed that the ball travels at - as soon as I move the slider (to the bottom
of the game rather than the current right hand position) - and update the startDrag coordinates - the computer's pong racket movement
becomes erratic.
You can see the demo game here: http://www.dirksmith.com/pong/pongTest.html
Grateful for any help.
.fla attached
Dirk
The scripts are:
slider actionscript on main timeline
onClipEvent (enterFrame) {
/:drag = Math.round(_root.diff._y - this._y)/ -10 ;
slider mc actionscript:
on (press) {
startDrag(_root.setter, false, 26, 65, 26, 140);
}
on (release) {
stopDrag();
Basic Game"
well.. im making a basic game for my first flash proyect... i need to do a boxing game (fighting) but just to make it simple I just need 2 red gloves that puch when the keys left or right are pressed... (right puch = right arrowkey) and the face of the enemy will look to the other side like if the glove really strike with a lot of force..(and if its possible a text that says "poooff")
im 17 years old and i want to learn how to do this kind of stuffs..
can any one give me an example of this?????
--Macromedia flash Mx 2004 --
Thanks
Help Making Basic Game
Can someone help me make a basic game? (something like a point and click or a really simple turnbased game)If you give me a code or anything to make stuff do stuff can you tell me what it does please? I also have 2 problems when following tutorials 1. I don't know how to make instance names(senocular tried helping but i didn't get what to click on) and 2. It only lets me select like layer 1 (or something similar) in actions not sure if thats supposed to happen. Thx in advance for helping
[F8] Making A Basic Car Game, Need Some Help.
Right.
I'm making a pretty basic car game to learn some of the basics of coding. What's going to happen is the standard 'Car moves across screen right and left and is controlled by keypresses, cars come down from the top of the screen and you have to avoid them. If you don't, you die' type game.
I'm having trouble with what happens when you die. I currently have it set so when you collide with a car, an explosion clip will appear on top of your car.
I'm not sure how to do this. I'm assuming I have to gather then X and Y positions of your car and then have them equal the explosion's X and Y positions, but I've been having trouble with them.
I've gotten hittests to work on walls and everything plus I've got movement down, but I'm stuck on the moving something without any interaction from the user.
Many thanks,
TheInsaneMAn
Basic Game Code Needs Help
Hi guys,
I need some help writing a code for my game, basically the end result will be a math game.
Right now what i am trying to accompolish is to randomly display a problem and a solution from a predefined set of problems and solutions without the same one showing twice.
ActionScript Code:
var level1 = new Array();
var level2 = new Array();
var level3 = new Array();
var active = new Array();
var correct = new Array();
var missed = new Array();
level1[0] = new Array("5+2", "7");
level1[1] = new Array("2*5", "10");
level1[2] = new Array("5-4", "1");
level1[3] = new Array("8-2", "6");
level1[4] = new Array("6-6", "0");
level1[5] = new Array("5*2", "10");
level1[6] = new Array("16+4", "20");
level1[7] = new Array("17-3", "14");
level1[8] = new Array("3+17", "20");
level1[9] = new Array("5-2", "3");
level1[10] = new Array("3+2", "5");seconds = 20;
time_left = seconds*12;
total_time = time_left;
temCount = 0;
function countdown() {
time_left--;
minutesLeft = Math.floor(((time_left/12)/60));
secondsLeft = Math.floor(((time_left/12)%60));
if (secondsLeft<10) {
secondsLeft = "0"+secondsLeft;
}
_root.remaining.text = minutesLeft+":"+secondsLeft;
}
function removeArray(Array1, Array2, a1_indexDelete) {
//trace(Array1.length);
a2_indexFill = Array2.length;
Array2[a2_indexFill] = Array1[a1_indexDelete];
Array1.splice(a1_indexDelete, 1);
}
function moveProblem(levelX) {
randomNum = Math.round(Math.random()*randCount);
trace(randomNum)
if (randomNum != 0) {
if (randomNum == levelLenght-1) {
randomNum = 0;
removeArray(levelX, missed, randomNum);
trace(randomNum+" Problem - "+levelX[randomNum][0]+" Solution - "+levelX[randomNum][1]);
} else if (randomNum%2 == 0) {
removeArray(levelX, missed, randomNum);
trace(randomNum+" Problem - "+levelX[randomNum][0]+" Solution - "+levelX[randomNum][1]);
} else {
randomNum--;
removeArray(levelX, missed, randomNum);
trace(randomNum+" Problem - "+levelX[randomNum][0]+" Solution - "+levelX[randomNum][1]);
}
} else {
removeArray(levelX, missed, randomNum);
trace(randomNum+" Problem - "+levelX[randomNum][0]+" Solution - "+levelX[randomNum][1]);
}
randCount--;
}
function dropInterval(levelX) {
division = Math.floor((total_time/levelLenght));
temCount++;
if (temCount>=division) {
temCount = 0;
moveProblem(levelX);
}
}
trace(level1);
levelLenght = level1.length;
randCount = levelLenght-1;
_root.onEnterFrame = function() {
if (time_left>0) {
countdown();
dropInterval(level1);
} else {
}
};
What can i say, it has many bugs....
Can anyone please "Proof read" this for me?
I really, appriciate your time
Thank you
~Gabor
Restarting A Basic Game
I have a basic hang man style game which records the name of the player and keeps a running score of wins and losses, but I want to implement a 'restart' which takes the back to the point where a player can enter their name (to start a 'New Game')
Im completly confused on how to do this as simply closing the game by various menthods doesnt erase the information.
Can anyone help?
Basic Flash Game
Hey guys
I am doing a basic drag and drop memory game. Basically you will see a combination of shapes for a few seconds then have to recreate that combination of shapes to move to the next level. I have the basic drag and drop script done, which looks like this for each object:
diamond.onPress = function() {
this.startDrag();
x_pos = this._x;
y_pos = this._y;
};
diamond.onRelease = function() {
stopDrag();
if (this._droptarget == "/idiamond") {
} else {
this._x = x_pos;
this._y = y_pos;
}
};
Now the thing I am unsure about is the action scripting to track when they place an object in the wrong place, so that I can make it so they have only so many trys (I may decide to do this on a timer instead like most memory games). And tHen the action scripting to tell when everythings been placed correctly to move on to the next level (scene/frame). If anyone has any suggestions or can give me some ideas about how to go about doing these things that would be awesome. THanks
Edit: Ok I think I figured out what I need to know, ill use a counter function in the script so that when it reaches the right number it will go to the next level
Basic Flash Game Tutorials?
Hello there,
Does anyone know how to produce a basic flash game such as space invaders or pong? links to tutorials would be gratefully received! thankyou!
Help With Basic Script - Dress Up Game...
Hey,
Im new here and have been having good success with the simple tutorial on how to make a dress-up game in 6 steps.
Well I have made one and it went fine but decided to make it better by putting te clothing in categories.
So I have my character and I have my clothing box next to it. I made that a symbol and inside that I made 5 buttons for 5 types of clothing. Hats, Lower, Shoes etc.
Now what I want is for these buttons to bring up their representive clothing then for the viewer to drag a hat on then he/she would click say shoes and put some shoes on.
My problem is the way I have done it is that each set of clothing is on a new frame so when you drag the hat on and click another button the hat will dissapear.
How would I if it is possible keep the hat their when I click another button. So that the person can basically choose a clothing from each section to make an outfit.
Would it work if I made the clothing inside the button symbols?
Anyway any help would be greatly appreciated.
Thanks,
XS-Dean
PS - I am using Macromedia Flash MX
Basic Moonlander Game Tutorial?
Hello, i'm new to these forums as you can tell.
I'm asking if anyone know's where i can find a good, basic moonlander type game tutorial.
(Oh, sorry if this is the wrong area to post this, i'm not exactly sure : )
Thank's in advance.
Need Some Help With A Super Basic Game I Made
I have a glitch.
When you jump from the top platform to the bottom one, it doesnt go right on top of the next platform. Instead it goes several pixels ABOVE it instead of one it. Yet if you just fall off without jumping, it is fine.
Can anyone help me fix this?
I would really appreciate it.
I'm finally in the right direction for flash platform game dev. I just need some tweaking on this.
Here is my FLA:
http://www.joystickadventures.com/platforms.fla
Here is the SWF:
http://www.joystickadventures.com/platforms.swf
The controls are move left with left arrow, move right with right arrow and jump with space.
If you jump back to the top platform (which is glitchy because you can jump THROUGH it which shouldnt happen) it also glitches up the pixel placement.
Thanks guys, please try your best
[MX04] Basic Movement(asteroids Game)
i want to make a ship like the one in the asteroids game except without drift or acceleration so its just a triangle that turnes with the left and right aarow keys and goes forward with the up key, please help
[F8] Real Basic Click Game - Ascript Help
I am trying to create a real simple interactive game where:
on the left we have 6 buttons
On the right we have six jigsaw pieces
click Button 1 and only piece 1 animates into place
click Button 3 and only piece 3 animates into place
click Button 6 and only piece 6 animates into place
At the moment if I click Button 6, all pieces will animate into place before piece 6.
The code I've used on the buttons is:
on(release){
Piece1._x = 597.5;
Piece1._y = 191.7;
}
and give Piece1 (mc) an instance name of Piece1
I've read tutorials and tried, but cant make sense of why it wont work.
Yep, you guessed it I'm REALLY NEW to this ... and ...
Thanks for reading
Need Advice - Basic Platform Game/interaction
Hi there,
I am looking for some advice on how to achieve the following:
I have an image which will be used as a background image. However, I am looking to add some interactivity to my website.
The website is for a fan website dedicated to a 1980's retro gaming character (Commodore 64).
Basically what I want to do is to allow the user to control the character using keyboard arrow keys. The user will be able to move left, right and jump (also jumping diagonally upwards left and right).
The image I have is made up of platforms which will allow the user to move upwards and downwards on the screen.
There will be some items on the screen that if the user/character goes up to them and hits enter, a message will appear.
Does anyone know how I would achieve this, and are there any base scripts out there that I could build upon?
Thanks!
[cs3] Creating A Basic Flash Platform Game, Part 1
Creating a basic Flash platform game, part 1
In this tutorial you will be making:
-A main character
-Terrain
TERRAIN
1.Draw your terrain. For this you should probably use a straight, horizontal line.
2.Convert your line into a movie clip.
3.Name it “terrain” (no quotes).
MAIN CHARACTER/AVATAR
1.Draw the body of your character (no legs or arms yet, and no head if you want it animated).
2.Convert it to a movie clip.
3.Name it “man” (no quotes).
4.Double click on the character to edit.
5.Insert the action stop(); on the first frame.
6.Use the next few frames to animate your character walking.
7.Double click on the background to deselect the character.
8.Add these codes to the character.
onClipEvent (load) {
gravity = 0.2; yspeed = 0; xspeed = 1; jumping = 0;
}
onClipEvent (enterFrame) {
if (_root.go) {
if (Key.isDown(Key.LEFT)) {
if (!_root.terrain.hitTest(_x-_width/2, _y+_height/4, true)) {
_x -= xspeed;
}
} if (Key.isDown(Key.RIGHT)) {
if (!_root.terrain.hitTest(_x+_width/2, _y+_height/4, true)) {
_x += xspeed;
}
}if((Key.isDown(Key.UP))(!jumping)){
yspeed = -5; jumping = 1;
} yspeed += gravity; while (_root.terrain.hitTest(_x, _y+_height/2, true)) {
_y--; yspeed = 0; jumping = 0;
} if ((!_root.terrain.hitTest(_x, _y+_height/2+1, true)) or (yspeed<0)) {
_y += yspeed;
} else {
yspeed = 0; jumping = 0;
}
}
} onClipEvent (load) {
scale = _xscale;
} onClipEvent (enterFrame) {
if (key.isdown(key.right)) {
this._x += 10; _xscale = scale; play();
} if (key.isdown(key.left)) {
this._x -= 10; _xscale = -scale; play();
}
}
Basic Flash MX Game Including MySql Database
Hi there,
does anybody know of where i should start to gain any tutorials etc
enabling me to createw a simple game and to be able to store the scores in a mysql database?
any hel greatley appreciated.
cheers
richard
Is There A Flash Tutorial For This Kind Fo Basic Game Engine?
This is pretty basic:
I just need to know how the engine generation works for a game like this:
http://www.newgrounds.com/portal/view/463138
Like how they consistently generate those rows of blocks. Is there a tutorial anywhere for that?
I don't need the hitTest or collision detection, but I can't get blocks to generate right.
[MX04] Outputing String From Flash Game In Basic Html File
Hi guys,
I've created a flash game. Once the game is finished it outputs a string to the screen in a text window. This works fine when it is tested in flash mx. Once i embed it in my basic html file the text box does not appear.
Here is the code to embed the flash game
Code:
<embed
src="project.swf"
width="800"
height="600"
allowscriptaccess="always"
allowfullscreen="true"
/>
here is the line of code that outputs the data to the screen
Code:
trace("whats been saved " + resultsSharedObject.data.result);
Does anyone know if this is the right way to do it. Again it works fine within flash but not after i embed in the html file and test it there
Thanks for help guys
I'm Having Troubles With The "Creating A Basic Platform Game" Tutorial
Hello,
I've been going through the above tutorial on flash kit and i can't get it to work!!
I'm using Flash MX Pro 2004 (trial). I've followed pages 1 and 2 to a tee (i think). The next thing I do is drag a copy of the HERO movie onto the page and paste in the code thats been written into the actions window with the HERO MC selected. I preview the game - there are no errors reported and the hero starts falling. Then it keeps falling! Through the platforms. I've made them thick, made them out of rectangles, lines and the pen tool. I wonder if you have any idea why?
Thanks.
the tutorial is here: "http://www.flashkit.com/tutorials/Games/Creating-baz_prod-1052/index.php"
Slider To Scroll Thumbnail Mc W/ Buttons Inside...onRollover Text Moves With Slider
I'm using a slider to scroll a movieclip made up of thumbnail images that are buttons. When I put my mouse over each button, I want it the image to change from black and white to color, and for a text description to appear in one fixed location on the main stage. Right now the image change to color is working, and the text appears as well, BUT the text scrolls as well, since it's within the scrolling movieclip. I want the text to appear static at a fixed location of: x=-947 and y=65. HELP!!!
It should look similar to: http://www.ehdd.com
Here's my code:
for my movieclip:
onClipEvent (enterFrame) {
_root.scrollMC._x = -.295*(_root.slider.b);
}
for my slider (set to scroll along "path"):
on (press) {
startDrag(this, false, 4, 270, 802,270);
}
on (release, releaseOutside) {
stopDrag ();
}
onClipEvent (enterFrame) {
a = new Object();
a.y = this._y;
a.x = this._x;
_root.path.globalToLocal (a);
b = int(a.x*2);
}
Slider In Reverse - Typed Text Makes Slider Move...help?
http://www.kirupa.com/developer/mx/slider.htm
Great tutorial...thanks by the way
But I was just wondering if anyone knew how you would go about doing this kinda in reverse? In that you type the percentage number in the text box and the slider moves up to that number?
Thanks in advance for your help
Slider Menu - Resize Slider And Change Btn Color
Hi there,
I am using code from http://www.kirupa.com/developer/mx20...ith_slider.htm. and
I found how to make slider smaller or bigger in this forum but I don't know what wrong of my buttons. The width of the slider is not same as all buttons. It looks smaller and on the right more.
Actually, I would like to make the same slider menu at <A href="http://www.grouplotus.com/grp/">http://www.grouplotus.com/grp/. Their buttons can change color even mouse out. Could you or someone else can teach me how to do that?
my flash file
http://www.halfuncorner.com/flash/btn.swf
http://www.halfuncorner.com/flash/btn.fla
many thanks,
jo
Catch The Url...
Well, my problem is quite hard to explain: first because I'm a frog and my english is poor, and then because I don't know actionscript very well...
So I'd like to put a swf animation into a php page with something like:
"echo "<EMBED... ""
and I want to recover some images' url into my animation to be able to display it dynamically.
I found that I could pass some variables values through the Url by typing anim.swf?var=value but it doesnt work with strings...
Thank you for your answers!
Try And Catch In AS2
is something like this is possible in AS2 :
PHP Code:
method1
try{
method2
}
catch(exception)
{
}
method2 throws exeption
{
arr[99]=4 // no index 99 erro will be eandle in method 1
}
thnaks in advance
peleg
Help Come Catch The Bug Please
Hi there! I'm making a multiple choice quiz for my project using Flash MX 2004. The quiz is basically finished and it does work, however I'm having nightmare of catching a bug I've found in the quiz, which I've no idea of where the mistake is. Now wondering if anyone here can please give me a help and that'd be great.
Basically, the whole quiz consists of 11 frames, which loads questions randomly from 3 external XML files, each containing 10 questions and 4 answers for each question. There's 1 dynamic textfield for question, 4 for the answers and 4 buttons for choosing the answers. There's also 1 dynamic textfield for displaying the current question number and 2 movie clips which will display a "correct" or "incorrect" message when the user selects an answer. Here's the main section of code for my quiz (frame 2 to 10):
Code:
var record = 0;
var total = 0;
var current = 0;
var score = 0;
var r=random(3)+1; //choose one of the 3 question files randomly
var right:String;
var question = new XML();
question.ignoreWhite = true;
question.load("questions"+r+".xml");
str= "";
question.onLoad = function() {
question_txt = this.firstChild.childNodes[_root.record].attributes.question;
answer1_txt = this.firstChild.childNodes[_root.record].attributes.answer1;
answer2_txt = this.firstChild.childNodes[_root.record].attributes.answer2;
answer3_txt = this.firstChild.childNodes[_root.record].attributes.answer3;
answer4_txt = this.firstChild.childNodes[_root.record].attributes.answer4;
right = this.firstChild.childNodes[_root.record].attributes.correct;
total = this.firstChild.childNodes.length;
current = record+1;
entryNum_txt = current; //current question number
};
stop();
a_btn.onRelease=function(){
if (right=="A"){
score+=1;
correct_mc.play();
} else {
wrong_mc.play();
wrong_mc.str="Correct answer is "+right;
}
}
b_btn.onRelease=function(){
if (right=="B"){
score+=1;
correct_mc.play();
} else {
wrong_mc.play();
wrong_mc.str="Correct answer is "+right;
}
}
c_btn.onRelease=function(){
if (right=="C"){
score+=1;
correct_mc.play();
} else {
wrong_mc.play();
wrong_mc.str="Correct answer is "+right;
}
}
d_btn.onRelease=function(){
if (right=="D"){
score+=1;
correct_mc.play();
} else {
wrong_mc.play();
wrong_mc.str="Correct answer is "+right;
}
}
nextQuestion=function() {
if(record + 1 == total) {
gotoAndStop("end");
} else {
record += 1;
}
question.load("questions"+r+".xml"); //choose one of the 3 question files randomly
}
This is the code on Frame 1:
Code:
stop();
start_btn.onRelease = function() { //start button which takes u to frame 2
gotoAndStop("Scene 1", 2);
};
And this is the code on the last frame (11):
Code:
message_txt = "You scored "+ score +" out of "+ total;
playagain_btn.onRelease = function() { //button takes u back to frame 1
gotoAndStop("Scene 1", 1);
};
Now the problem is that sometimes when I play the quiz it finishes after the 4th question whereas sometimes it works perfectly and I can finish all 10 questions. Anyone knows where the problem is and what I've done wrong???
Tell me please if you do know. Thank you very very very much!
Catch Try
I'm trying to catch an error when logging in via a web service. Currently have this on a login button, with text boxes for login and password.
try
{
this._parent.wsLogin.trigger();
}
catch(Exception)
{
this._parent.txtReply2.text = "error " + Exception;
}
finally
{
this._parent.txtReply3.text = "triggered";
}
never gets to the finally even when i use the correct login / password. If I use a bad login, I get 'Error opening URL' and name of URL in trace, which is what i was hoping to trap with exception. I'm a .net user so tried (Exception error) but this gave me a compile error at line 23 which is strange cos my code is only 12 lines long...
I am totally new to Flash and totally lost.
Try..catch?
Is this not a good try..catch?
Code:
try
{
thisLabel = formsHolder.getChildAt(0).conditionalCB.value;
}
catch(e:Error)
{
thisLabel = E.target.name;
}
It's still throwing compiler errors.
I've noticed that all my try..catch's have been acting up lately, as well.
I think it started when I re-installed my system; alt, what are the chances of corrupting the API (when it's linked to Flex AS Projects)? Is the try..catch even in an AS?
Fade Slider Not Image Slider HELLLP
i am trying to bulind a slider to fade btween 3 image Image 1(Past0, Image 2 (Present), Imag2 3 (Futher)
info
Image 1 is Constant as it is the base layer
Image 2 is Variable inatly set at 100% Alpher (middle LAYER)
Image 3 is Variable inatly set at 0% Alpher (top LAYER)
i want the slider to star off in the middle posing an image 2 100% and image 3 is 0% and when the slider moves left Image 2 alper will go down revlling image 1, and when the slider moves right i want Image 2 to remain a 100% and image 3 to go from 0% to 100%
can any on help
thanks blue
Slider Wont Work For My Menu Slider
i tried following this tut on a menu slider http://www.kirupa.com/developer/mx20...th_slider2.htm, but I cant seem to get the slider to work, whenever I test the movie the slider just slides to the left corner and than doesnt move after that. anyone know what is going on or have any advice??
i posted my swf file to show you and then the fla file if anyone actually wants to see everything.
Im kinda new to flash so I obviously dont know what is wrong. Any help would be very appreciated.
Slider Menu - Resize Slider And Btn Color
Hi there,
I am using code from http://www.kirupa.com/developer/mx20...ith_slider.htm. and
I found how to make slider smaller or bigger in this forum but I don't know what wrong of my buttons. The width of the slider is not same as all buttons. It looks smaller and on the right more.
Actually, I would like to make the same slider menu at <A href="http://www.grouplotus.com/grp/">http://www.grouplotus.com/grp/. Their buttons can change color even mouse out. Could you or someone else can teach me how to do that?
my flash file
http://www.halfuncorner.com/flash/btn.swf
http://www.halfuncorner.com/flash/btn.fla
many thanks,
jo
TAB Catch Don´t Work In IE5 PC ?
Hi,
I´ve made a simple TAB catch script to disable the button and field selection via keyboard.
I check if the emailform is not open, and if not, the focus is set to a dummy tabcatcher mc with a button inside.
If the emailform is open the focus is set to the next inputfield of the form.
The script works perfect on MAC IE5 and Netscape4.7, also on PC Netscape 4.7, BUT not on PC IE5 or IE5.5!
Any idea?
onClipEvent (keyDown) {
if (Key.getCode() == 9) {
if (_root.menu != 6) { // checking section user is in
Selection.setFocus("_root.mcTabcatch"); // sets the focus to the tabcatcher
} else {
// emailform is open
_root.nextTab(); // function call to focus the next inputfield}
}
}
Catch All Variable
I've made a search using only Flash that takes a variable from a search field and grabs the coordinating info from an external TXT file that has a string of variables in it, and then put the info in a scrollable text field. The only thing I can't figure out how to do I make it report back when there is no match.
I've tried IFs and ORs and just about everyway to communicate it, but nothing is working. The scripts all make sense, but then they don't work .
Any one know how to make a sorta catch all variable that it finds when nothing else in the string matches.
Gracias in advance.
Who Can Catch The Insect?
I've been fighting this script for the whole day now:
fscommand("bc",stock+"&"+A+","+B);
if(check==0)
{
_root.bc1.warning._visible=true;
}else if(match==1){
_root.bc1.warning._visible=false;
}
the fscommand i'm calling is supposed to return me either 0 or 1 value for the variable "check" and depending on the result the error message gets visible/invisible.
The fscommand is working fine and it returns me the 0/1 value (i used a dynamic textbox to make sure) but Visibility of the movieclip in the conditioal statement is not affected anyhow..
do you see the bug?
Throw,catch Set And Get In AS2
does like in java there are execeptions in AS2,using throw,catch?
does he set get method exist?
if yes can any 1 reffer to examples?
thnaks in advance
peleg
Little Prob To Catch Var
hi all
that is the base of flash, but i try since 1 hour and didn't find my mistake, if somebody can help me, will be really gratefull :
i try to do a google form field submission
so got an input field component in a clip
the target is " _root.imove.imove2"
so i can't find the way to catch the var "q" associate to my texte field
My code on the main keyframe is
/
/------------------google
var q = _root.imove.imove2.q; <<<< that is wrong
google = function () {
getURL ("http://www.google.fr/search?q=" + q + "&hl=" + fichier , "_blank") ;
}
_root.imove.imove2.btgoogle.onPress = google ;
thanks in advance
Try .. Catch Problem
So this is the thing:
I want to dynamically load a set of images.
The code is as follows:
Code:
setInterval(showNext, 5000);
i = 0;
function showNext() {
try {
loadMovie(i+".jpg", my_mc);
} catch (e) {
i= 0;
}
i++;
}
Say I have 5 images in the directory named "1.jpg" to "5.jpg" What I want is that when it has loaded the "5.jpg" it should set back the counter to 0 and start over loading the first image again.
My problem is that I can't get the try..catch to work. (it never goes into the catch) Does anybody know what the problem is?
metaman
Catch All Events
Hi.
I have a dynamic array with references to movie clips i want to cach all events of the movie clips in this array.
How do i do this?
Catch On A Textfield
I would like to be able to catch onMouseDown on a textfield and I don't see why the following won't work
selectedTxtField:String;
myTxtField_txt.onMouseDown=function() {
selectedTxtField="myTxtField_txt";
trace(selectedTxtField);
};
Mouse.addListener(myTxtField_txt);
This works to the extend that no mather where on the scene you click the mousedown function is called, rather than only being called when the mouse is down inside the text field, what am I doing wrong?
Please, help me!!!
Catch'em Flash HELP
I am creating a flash game in which i want things to drop randomly from the sky in different places so that a rabbit can catch them does anyone know the actionscript to make this happen?
[f8] To Catch An Error
Hello
I have to load a few SWF externally in my main movie.
I have an array that holds file names to load.
I use loadMovie as usual, and all goes ok.
BUT what if one of my SWF movies is NOT on server?
How can I catch that error and have a message like "File X.SWF doesn't exist".
A small AS snippet code would make wonders for me.
Thanks.
Catch IP On Enterframe
Hi!
I was wondering if there is a way to get the users IP when entering a frame..
Etc. inserting the IP in a dynamic text box...
Is this possible without any scripting outside Flash?'
Thanks.
|