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




Speed Tests Using Image Bytearrays



This following information is very interesting and not at all what I would have expected.The following tests were conducted to discover the fastest ways to load in a 1600x1600 px image from the library and alter each pixel color one at a time.I have times each attempt 10 times and given an average below.The head code is used to set up the test.//HEAD CODEvar imgWidth:int = 1600;var imgHeight:int = 1600;var libraryImage:BitmapData = new libImg(imgWidth,imgHeight);var rect:Rectangle = new Rectangle(0, 0, imgWidth,imgHeight);var libImgByteArray:ByteArray = libraryImage.getPixels(rect)var pixAlpha:int,pixRed:int,pixGreen:int,pixBlue:int;//BODY CODE - TEST 1libImgByteArray.position=0;while(libImgByteArray.bytesAvailable>0){ pixAlpha = libImgByteArray.readByte(); pixRed = libImgByteArray.readByte(); pixGreen = libImgByteArray.readByte(); pixBlue = libImgByteArray.readByte();}//Timed results in millisecondsTOTAL TIME: 12092ms Average:1209.2ms for 10 passes.//BODY CODE - TEST 2var pos:int=0;var len:int=libImgByteArray.length;while(1){ pixAlpha = libImgByteArray[pos]; pixRed = libImgByteArray[pos+1]; pixGreen = libImgByteArray[pos+2]; pixBlue = libImgByteArray[pos+3]; pos+=4; if(pos==len) { break; }}//Timed results in millisecondsTOTAL TIME: 3828ms Average:382.8ms for 10 passes.Now forgive me if I am wrong. But shouldn't the first example be faster? or at least just as fast? I would have thought so. Maybe I am missing something here. But most professionally written code I have seen will loop through a byteArray using the .position, .bytesAvailable and .readByte .readInt methods.How can it be that using readByte is so much slower than accessing the array by direct index. What is the point of even using readByte at all if it is 4 times slower?Is there a faster way I have not yet found. It seems strange to me that the inbuilt flash functionality such as floodFill and threshold would be required to test evey pixel.. yet those functions can do it in a very small fraction of the time it takes me to simply loop through and read each pixel colour. Is there a way I make this above code faster?



Adobe > ActionScript 1 and 2
Posted on: 08/06/2007 06:18:24 AM


View Complete Forum Thread with Replies

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

Flash App That Tests Connection Speed?
Greetings all...

I have seen a couple examples of companies that are using a Flash app to test the connection speed of cable modems, T1 lines, etc...

Do any of you have an idea of how this could be done? Any sites I can visit to see a tutorial of this created?

One example that I have seen is http://www.houston.rr.com/SpeedTest/speedTest.html

How is this built?

any insight would be greatly appreciated.

cheers,

~cs

Adding 2 Bytearrays
Hi,

If I have 2 bytearrays how would I go about Adding them together into 1 bytearray?

Thanks,
dub

ByteArrays And Sounds
Basically, I'm trying to draw an audio waveform from a loaded sound file. My approach so far has been to load an AIFF file using URLLoader, set the data format to binary, and then read the ByteArray. But here's where I'm just at a loss. I'm not sure what to do with those bytes.

Has anyone done this, or can point to something I've missed with the Googles?

For the record, I've also tried just loading the MP3 and using SoundChannel.leftPeak, etc, to go through the sound file, but there are three problems with this approach:
It's not every sample, and just the amplitude of the sound that just happened to be playing when I read the peak. This leads to a "poll" of say, every 10th sample, rather than the actual average of those 10 samples, which can be inaccurate. In my tests so far, this is significant in sounds that are highly transient and percussive.Capturing the data means playing the sound. To capture higher resolutions of data, I need to play the sound longer. Time isn't a crucial factor, but it's cumbersome, and on top of it, the computer is producing noise. If I turn the volume down on the sound, the peak data turns down with it. Thus, running the process means lots of noise. This is the deal-breaker.The amplitude is is value from 0 to 1, so I'm not getting any data for the "other side" of the waveform. This isn't too bad of an issue, because I can simply mirror the drawing and get a traditional-looking image, but it's still less than ideal.
Any thoughts, advice, or guidance will be appreciated! Thanks!

Running Speed With Image (Please Help)
i have a flash movie that i created with a picture in it as bluprint (a layer behind everything else)so i can look at it to duplicate it an then animate it. now that im finished doing it i delete the image and it runs slower thaln it does with it. when i put the image back it runs faster. what is up with that???

thanx!
austin

Multiple Image Panning With Different Speed
Hi,

I'm trying to create a 3d virtual enviroment; I need a script that can pan images , something like exploring it.

Here is the sample sites :-

1) http://portfolioris.nl/intro.htm - it pans and it will zoom in to the certain image : how he do that?

2) http://www.formshape.com/ - pan with different speed. object infront faster, behind slower

Anyone can help ? Thanks so much!

Variable Speed Image Slider
Hi ppl

I am hoping to create a nav device similar to that on the http://www.nike.com/jumpman23/xx3/ site. Find the circular nav thingy and move it left and right to move the environment in the background. See how it speeds up the further it gets away from the centre and slows down to a stop when gets back to the centre. I am not worried about the zoom effect but could anyone help me in creating the left and right movement. I am not much of a coder as I am graphic designer.

Thanks very much.

Is There An Image Compression Script Based On Speed?
you know how you can set an image compression percent in the library of each image.

we'll can anyone help me with a flash 5 script that will allow me to make the image quality based on the users connection speed?

for example if 28K or less, the image in the library named cover.jpg will be set at 40%.

and if you have a 56K it would be 75%.

i would really appreciate nay help with this.

thanks,
dave

Scrolling Image Control Speed By Mouse
I followed this from a tutorial I found where you use the mouse to control the scroll speed.

http://fenwickplantation.com/g_gallery.htm
Move the horizontal browser scroll bar all the way to the left to see it.)

I made the size of the movie 2400 px, since that is the size of original graphic, but you have to move the horizontal scroll bar all the way to the left to see it! So, you can see my problem!

I changed the width of the movie, but this made the whole thing shrink! It also made it nearly impossible to work with the fla file. Anybody know the answer before I pull my hair out? It's got to be something simple I'm missing. What can I do with this fla file?

Here's the fla download link:
http://fenwickplantation.com/scrolli...ry_fenwick.zip

Any help greatly appreciated

Variable Speed And Direction (L+R) Image Scroll
Hello,
I am an absolute newbie at Flash. I've been going over all the training I can for DreamWeaver HTML, CSS and Flash at Lynda.com
Whilst I can make sense of HTML and CSS, I am having a hard time grasping Action Script.
What I'd like to do for some might be easy to do. Your advice would help me decide if a newb can do this or if it is over my head.
I'd like to make a scrolling stage of images about 300x400 pixels say 20 images max where the mouse moved to the left or right from center controls the speed and direction of the scroll. Nothing needed in the way of zooms, enlarge, or swap image, nor clickable links.
I made a 3 part frame-set in Dreamweaver with the center frame being built with a table 20 columns wide which works, but frame-sets are not the desired way to go for a photographer's website.
What is involved, where should I look, and is there somewhere to buy the code already done to do make this easier if at all possible?
Thanks.

Scrolling Image Controlling Speed W/mouse
Hi everyone

I followed infinite menu tutorial somewhat successfully but not quite for this effect:
http://fenwickplantation.com/scrolli..._fenwick2.html

The graphic is 2400 pixels wide and the movie is 600 pixels wide. But, for some reason it's skipping, and not showing the full image:
http://fenwickplantation.com/collage_2400.jpg What do I need to change in the code to make it roll continuously showing everything? I'm just clueless right now

Here's the fla:
http://fenwickplantation.com/scrolli...y_fenwick2.fla

Any help so greatly appreciated


Code:
onClipEvent (load)
{
xcenter=300;
speed=1/50;
}
onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
}
onClipEvent (enterFrame)
{
var distance=_root._xmouse-xcenter;
_x+=(distance*speed);
if (_x > 0) _x=-300;
if (_x < -300) _x=0;
}
oops, forgot to paste code

Image Scroller - How To Control Initial Speed & Direction ?
I adjusted Barry Driessen's Photoscroller to my needs and its working really good. The only problem I have now is that the Scroller's initial movement (right after the page/movie loaded) is depending on the user's mouse position/movement on the page. So sometimes it moves fast, sometimes it almost doesn't move at all after the movie loaded.

I would like to have a nice slow movement (to the left) that does not change until the user moves his mouse the first time over the movie.

How could I achieve this??


The main ActionScript looks like this:

FRAME 1:
Code:
// Xphoto = startposition of the scroll image
xphoto = 0;

// Widthmovie = This variable has to be set to the same amount of the moviewidth
widthmovie = 520;

// Scrollspeed = The scrollspeed of the image (high numbers result in slow scrolls 10=average)
scrollspeed = 100;

// widthphoto = the width of your scrollable image in pixels
widthphoto = 960;


FRAME 2:
Code:
// Setting the xmouse to 0 in the centre of the movie:
xmouse = _xmouse - (widthmovie / 2);

// Setting the speed:
speed = (xmouse) / scrollspeed;

// If the speed is negative, the speed will be made positive here:
if (speed < 0) {
speed = -(speed);
}
// If the mouse moves to left, the photo will scroll to the right:
if (xmouse < 0) {
xphoto = xphoto + speed;
}
// If the mouse moves to the right, the photo will scroll to the left:
if (xmouse > 0) {
xphoto = xphoto - speed;
}

// Checking for the left end of the image:
if (xphoto > -1) {
xphoto = -480;
}
// Checking for the right end of the image:
if (xphoto < -480) {
xphoto = -1;
}
// Placing the moviclip (photo) on it's new postition:
setProperty("photo", _x, xphoto);


FRAME 3:
Code:
gotoAndPlay(2);

How You Guys Make That Cool High-speed Flashing Text Or Image.
You know, those slick flash sites where a text or image appears and flashed on/off several times a second.

Like switching the light on.

Can anyone give me an example using a text or an image and make it flash like crazy?

Thanks for any help you may given.

Hit Tests Please Help
I am making a game where i have balls firing and they are to bounce off everything in a movie clip called bg(for background. my hit Zones seem to work when the balls going going straight up or down, but not when hitting side walls, they just get sucked in to the side walls. i will leave the code for my hitzones....what is going on here? any ideas?

you can ignore the part about corner of a box.

if (_level0.bg.hitTest((_parent._x + this._x), (_parent._y + this._y), true)){
_parent.hit = true;
if(this._x == 0){
//bounce vertical
_parent._y = _parent.lastY;
_parent.Vy = -1 *_parent.bounceFactor * _parent.Vy
}

else if(this._y == 0){
//bounce horizontal
_parent._x = _parent.lastX;
_parent.Vx = -1 * _parent.bounceFactor * _parent.Vx
}

else{//this hitzone is on the corner of a box
//trace("corner");

_parent._y = _parent.lastY;
_parent.Vy = -1 *_parent.bounceFactor * _parent.Vy
}
}
else{
_parent.hit = false;
}

thanks, Jon

Better Hit Tests
Hey you must get this all the time, but i am making another game and i getting so anoyed with hit test. I am doing a hit test between two objects say circles. If the two circles are close 2 each other but not touching, in a postion as if they were squares of equal size they would be touching. and the hittest returns true. Is there anyway of getting round this? Is it possible to stop hittest from cutting corners???

[F8] Hit Tests :(
i was making a simple platform game, but i can get only as far as one platform. i just need to know if i should make another hit test, what it should say and where to put it

Hit Tests
I don't know how to use hit tests. Alright, I have a movie clip called Ball which moves around with the arrow keys. I drew a box around it and called the box Wall. How do i make it so that the ball can't go through the wall?

Hit Tests
I have been trying all day to get a hit test to work, without success. I have looked at the tutorials here and in several manuals I have at home. The beginner tutorial doesn't work in my movie and the Intermediate tutorial uses a separate clip for the action script.

I have two movie clips, one of which can be controlled onscreen using the direction keys. The second is static. Both instances are named. I have tried attaching code to the moving clip. I have tried attaching code to the static clip. I have tried appending code to the direction controls. I have tried adding a new layer for scripts. In other words, I am pretty well stuck!

An indication of the correct code, along with where to put it (!), would be fantastic.

Help please!

Hit Tests
Hi
I have a problem with hit tests, if you make a object that is any shape other then a square it createds a invisable square around it and uses the as the edge for hit tests. I have a ship you move around rounded astriods and i need it to be exactly where you see the edge, and not where the edge of the box is.
this is the code im using.
Thanks.







Attach Code

_root.spaceship_mc.onEnterFrame = function() {
if(this.hitTest(_root.astriods_mc)) {
gotoAndPlay("you lose", 1);
} else {
this.gotoAndStop(1);
}
};

Alpha Tests?
I have MX, and when I do an alpha tween, it will do the tween on the stage and when moving the head thru the timeline, although when i do a control > test Movie, my fades never show. Is there an option that that I have to hit in order to see these tween effects? Every other tween works fine, except for the alpha. Like I say its only when testing the movie. On the stage while draging thru the timeline it works fine.

xmaddness

Simple HIt Tests
Hi i have a simple game where a fly runs away from spiders and when they hit the spiders the score increases and a dynamic text field populates with bitten. However I am getting an expected "(" syntax error on line 15 / 17 cant work it out. If any1 could help it would be ace.

stop();
score = 0;
bitten.stop();


//
onEnterFrame = function () {
scoreText.text = score;


if (Score >= 50){
gotoAndStop("Scene3",3);
}

if (1.hitTest(_root.steve)) {
_root.Bite = "Bitten"
_root.score++;
} else {
_root.Bite = " "
}

if (2.hitTest(_root.steve)) {
_root.Bite = "Bitten"
_root.score++;
} else {
_root.Bite = " "
}

if (3.hitTest(_root.steve)) {
_root.Bite = "Bitten"
_root.score++;
} else {
_root.Bite = " "
}

if (4.hitTest(_root.steve)) {
_root.Bite = "Bitten"
_root.score++;
} else {
_root.Bite = " "
}

}

[F8 Pro] Problem With Hit Tests
Hi

I've made a horizontal bar that rotates at its center when the end is dragged up or down

on the bar is a ball and i want to make it so that the ball will try to move vertically downwards until it hits the bar at which point it stops

AND if the bar is rotated upwards the ball is pushed up and if the bar is rotated downwards the ball will move down with it

I'm having the following problems :

1) when the bar is rotated and is at an angle it becomes the diagonal of its bounding box - the ball hit test therefore returns true when the ball isn't even touching the bar

2) I can't figure out the best way of moving the ball along so that when the bar is rotated it always sits on the uppermost surface of the bar

I have attached a simple model as a fla (Flash 8 pro on PC) so that you can see how i'm doing it

i really want to code it so that the ball can drop from the top of the swf onto the bar and then slide down along the bar if the bar isn't horizontal

i have a feeling that i'm going about it all the wrong way and i would appreciate someone with more experience giving me some pointers on another way of approaching the problem

thanks

[CS3] Hit Tests Within A Fuunction
hello,

I am in a multimedia class where we make video games. so now i am making a 2 player tank game with an aerial perspective. I am using a "Master" function to make the tank move and fire around the level. Now the problem i am having is putting in the hit tests to stop movement in any direction. I have tried everything i can think of to make the hit tests i even tried another function within the "master" function, but flash said that their were to 256 recurrences and flash said it was a never ending loop and stopped all the action. here is the script i am using.



PHP Code:



function changeAngle(num) {
    ship.angle += num;
    ship.angleRad = ship.angle*Math.PI/180;
    ship.cosAngle = Math.cos(ship.angleRad);
    ship.sinAngle = Math.sin(ship.angleRad);
    ship.x_inc = ship.speed*ship.cosAngle;
    ship.y_inc = ship.speed*ship.sinAngle;
    ship.clip._rotation = ship.angle;
}
function captureKeys() {
    if (Key.isDown(Key.RIGHT)) {
        changeAngle(5);
    } else if (Key.isDown(Key.LEFT)) {
        changeAngle(-5);
    }
    if (Key.isDown(Key.UP)) {
        ship.xmov = ship.x_inc;;
        ship.ymov = ship.y_inc;
    } else if (Key.isDown(Key.DOWN)) {
        ship.xmov *= decay;
        ship.ymov *= decay;
    }
    if (Key.isDown(Key.SPACE) && okToShoot) {
        okToShoot = false;
        var newDepth = ++depth;
        var name = "projectile"+newDepth;
        var clip = _root.attachMovie("projectile", name, newDepth);
        clip._x = ship.x;
        clip._y = ship.y;
        clip.xmov = speed*ship.cosAngle;
        clip.ymov = speed*ship.sinAngle;
        clip._rotation = ship.clip._rotation;
        clip.onEnterFrame = function() {
            this._x += this.xmov;
            this._y += this.ymov;
        };
    } else if (!Key.isDown(Key.SPACE)){
        okToShoot=true
    }
}
function moveShip() {
    ship.x += ship.xmov;
    ship.y += ship.ymov;
    ship.clip._x = ship.x;
    ship.clip._y = ship.y;
}
_root.onEnterFrame = function() {
    captureKeys();
    moveShip();
};
ship = {};
ship.xmov = 0;
ship.ymov = 0;
ship.angle = 90;
ship.clip = ship_clip;
ship.speed = 3;
ship.x = ship.clip._x;
ship.y = ship.clip._y;
decay = .9;
depth = .1;
speed = .0000000000001;
changeAngle(0)





What ever input anyone can apply will be greatly appreciated

Thank You

Flash Tests
HI everybody,

I am not too new regarding flash, but at least new here so thank you in advance for your warm welcome!

I am looking for flash tests files, where I could basically evaluate my skills (something like beginner - intermediate - expert). Not really a tutorial, more a "can I do it" type of thing.

Thanks a lot in advance and see you soon around!

Penny1

Multiple Hit Tests
I currently have 10 hit tests in a row on the stage. How would I get a hit test to only initiate when the previous hit test has been hit?

So, for example I can’t hit the 2,3,4,5,6,7,8,9,10 hit tests, until the 1st hit test has been hit. And then the 2nd can't hit 3,4,5,6,7,8,9, 10 and so on...

Any ideas???

More Efficient Hit Tests?
I know i raised this issue before, but i didn't get any response, and i still need help with it.

I've been trying to make a few game things where it checks to see if objects have run into each other (as one does in games). However, i seem to always have to have lots of code running each time it enters a frame, which after a few objects appear, make everything slow down and lag lots. If anyone has some tips, it would be much appreciated.

Moving And Hit-tests
Yo,
I need a good way to make a movie clip move in directions when you press the arrow keys and a way to make him not run into walls (the walls will be another movie clip). Need some code and an exlplanation of it.

Preloading In Tests
I've been working on my own website and its going fine but there is one thing still bothering me. Why doesn't my preloader bar move? I have to right click and say "play" for it to advance. Is my preloader messed up or is that just how it is. By the way I have tried the simulate loading, but that didn't work either. Thanks for your time.

Ithaca

Multiple Hit Tests
I have this code that works for a normal hit test that triggers a mc animation in and out. But if i want to add more than one it just plays the last in the chain of events.


Code:
//Navigation
_root.finished = 100;
this.onEnterFrame = function() {
cursor._x = _root._xmouse;
cursor._y = _root._ymouse;
if (cursor.hitTest(nav1_mc) == true and _root.expand == false and _root.finished == 100) {
_root.finished = 0;
_root.expand = true;
_root.nav_mc.gotoAndPlay(2);
}
if (cursor.hitTest(nav1_mc) == false and _root.expand == true and _root.finished == 100) {
_root.finished = 0;
_root.expand = false;
_root.nav_mc.gotoAndPlay(11);
}
};
If anyone can let me know what i'm doing wrong that would be very helpful!

Faulty Hit Tests
here ive been making a little game (no way near finished) but for some reason doesnt like my hit testing half the time. It works more often at the start, but basicly ignors it all the other time. Heres the .fla, feel free to mess about with it, and if you fix it, tell me. Cheers! Btw, its on flash 8. Clik on the left grey block to generate a ball, and its ment to make a little smily face pop up when it hits the right grey block. stupid game.fla

Moving And Hit-tests
Yo,
I need a good way to make a movie clip move in directions when you press the arrow keys and a way to make him not run into walls (the walls will be another movie clip). Need some code and an exlplanation of it.

Preloading In Tests
I've been working on my own website and its going fine but there is one thing still bothering me. Why doesn't my preloader bar move? I have to right click and say "play" for it to advance. Is my preloader messed up or is that just how it is. By the way I have tried the simulate loading, but that didn't work either. Thanks for your time.

Ithaca

Still Some Flash 8 Tests
still testing some bitmap related things...
check them out

http://www.f-for-flash.com.hk/8ball_exp/

kit

Circles And Hit Tests.
Does anyone know of any good way you could do circle collisons with square movie clips? Hit test works sort of... It still lets the area outside the circle in, thus making for an inaccurate detection.

Overlapping Hit Tests
Hey guys, I just read a thread that asked some questions about a problem that I was having as well. But it appeared that he found the solution and unfortunately I couldn't follow the thread very well so I thought it would be best to post a new one.

Here's my layout:

sideMenu = instance of movieClip (menuBar)
|--> option a = instance of movieClip (menuButton)
. |-->BTN = instance of MovieClip (customButton)
. . |-->GLW = instance of MovieClip (button_glw)
. . . |--> simple shape animation
. . |--> LBL = instance of MovieClip (button_lbl)
. . . |--> NAME = instance of text field
. . |--> BG = instance of MoveClip (button_bg)
. . . |--> simple box with border
. . |--> SHD = instance of MovieClip (button_shd);
. . . |--> simple dropshadow shape
|--option b = same as option a...
|--option c ...

Now my logic was this: I created the (customButton) MC to include the logic states, "current" and "currentOver", so it has 5 frames instead of 3 (like a regular button).

buttonStates=["up","over","down","current", "currentOver"]

by creating aninstance of my (customButton) MC in another wrapper called (BTN) mc, I could then place my event handlers and onLoad handlers on the instance of (customButton)

Then I place several instances of the (BTN) MC on the stage, and turn this group into a symbol called "menuBar" and instantiated as "option a...". I plan to handle this all programmatically next, but not until I get past this hurdle.

FINALLY---the problem:
on the "OVER" frame from of the (customButton) mc, I have the drop shadow graphic in a MovieClip called button_shd and instantiated as SHD.

So I figured that when I told the (customButton) MC to swapDepths (overLevel), (where overLevel is defined to be a unique number smaller than any of the normal levels for (customButton) MC), it would put the entire clip above its peers. It does a great job of showing most of the (customButton) mc's pieces above the other (customButton) mcs. Unfortunately, it doesn't raise the dropShadow (SHD). It still appears below everything else.

I have tried placing a script on the (SHD) mc to tell it to set it's level to the highest level of all the MC's but no luck)

I am also having problems managing the overlap (so when the buttn is in state OVER, it gets bigger and overlaps other (customButton)mcs. So when I mouse over option b and then scoot up to where it overlaps option a, it blinks back and forth rapidly.

Is there a better way to do this? I have a tendency to make things much more complicated than need be. Any help, advice, direction, reference, empathy, etc. would be greatly appreciated.

Best wishes, thanks in advance for your help.

jase

Action Script Tests?
Is it possible, and if so how, to test for a sound being done. I am playing an MP3 on the intro to my site and would like to have It forward into the site on the end of the MP3.

Check it out here
http://www.swallowbush.tk

TROUBLE WITH HIT-TESTS.... DONT KNOW WHAT THEY ARE
hey ppl

the title says it all really
i dont know what these 'hit-tests' are, please could someone explain and/or make an example?
plz help coz it mite help me with a project i am on now...

thanx

Hit Tests Only Partially Working...
This is in a sort of Arkanoid clone, but not exactly. You control the ball to move horizontally, however hitting a brick on the top or bottom SHOULD rotate the vertical direction but doesn't.

Right now I'm only trying to do the Y-axis Hit Tests. But it only sends the ball downward no matter what. It only recognizes hitting the bottom. I'm guessing it's only executing the second statement as it becomes satisfied. What can I do?

obj1_hwidth = (getProperty(_level0[Ball], _width)/2);
obj1_hheight = (getProperty(_level0[Ball], _height)/2);
obj2_hwidth = (getProperty(_level0[greyBrick], _width)/2);
obj2_hheight = (getProperty(_level0[greyBrick], _height)/2);

obj1_x1 = getProperty(_level0[Ball], _x)-obj1_hwidth;
obj1_x2 = Number(getProperty(_level0[Ball], _x))+Number(obj1_hwidth);
obj1_y1 = getProperty(_level0[Ball], _y)-obj1_hheight;
obj1_y2 = Number(getProperty(_level0[Ball], _y))+Number(obj1_hheight);

obj2_x1 = getProperty(_level0[greyBrick], _x)-obj2_hwidth;
obj2_x2 = Number(getProperty(_level0[greyBrick], _x))+Number(obj2_hwidth);
obj2_y1 = getProperty(_level0[greyBrick], _y)-obj2_hheight;
obj2_y2 = Number(getProperty(_level0[greyBrick], _y))+Number(obj2_hheight);

if ((Number(obj2_x1)<=Number(obj1_x2)) and (Number(obj2_x1)>=Number(obj1_x1))) {
Ball._x += 15;
}
if ((Number(obj2_x2)<=Number(obj1_x2)) and (Number(obj2_x2)>=Number(obj1_x1))) {
Ball._x -= 15;
}
if ((Number(obj2_y1)>=Number(obj1_y1)) and (Number(obj2_y1)<=Number(obj1_y2)))
{
VertMoveSpeed = -4;
}
if ((Number(obj2_y2)>=Number(obj1_y1)) and (Number(obj2_y2)<=Number(obj1_y2)))
{
VertMoveSpeed = 4;
}

Online Tests For Flash MX
I know some recruiters want to test designers on their knowledge of flash MX. Once such website is http://www.proveit.com/default.htm.

I would like to know if there are any free websites that offer such tests to test one's knowledge of flash and action scripting before taking such a test?
Thanks

[CS3] Changing Frames With Hit Tests.
How what is the AS2 code I need to do this?

I've tried the following:

onClipEvent(enterFrame){
if(this.hitTest(_root.otherObject)){
gotoAndStop(2); //Yes I know using the frame numbers is bad.
}
}

Creating Addition Tests
I am creating a test to see whether peple can do simple addition (IT coursework :[) The only way I can think of doing it is having 2 movie clips and have 50 frames and each frame sets the variable to the number that's shown. Then there is an input text box and then a button that checks to see whether the two variables added together equals the number in the input box.

Is this the best way to do it, and how do I make Flash go to a random frame in the two movie clips?

I'm also doing a subtraction and multiplication one, but the code would be similar, wouldn't it? (Something like If (Input== Number1 + Number 2){ Goto frame "correct" else goto frame "Wrong} (Not correct sytax or whatever, but something along those lines, I haven't used if statements for a while)

Selecting Arrayed MCs For Hit Tests
Hi,

I'm trying to make a bubble interface similar to Jonathan Harris' and Sep Kamvar's We Feel Fine. I've successfully got a dynamically generated number of
circular movie clips floating around the stage. Their instance names are stored in an array. They
are set to bounce around the stage indefinitely. Now I want to add some mouse interactivity. When
I use a for loop to access the clips through the array and perform a hit test, the test is sucessful,
but the resulting actions occur to all the bubble clips not just the one hit tested. Is there a way
perhaps using "this" to modify the behavior of just one bubble clip. Here is the code for the hit testing.
I apologize for the verbosity. I am still quite a novice and I'm sure there are more concise ways to
write all of this. Thanks for the help and time.







Attach Code

/* Frame One */
bVar = 0;
bBtn.onRelease = function() {
if (bubbleArray) {
for (i=0; i<_root.bubbleArray.length; i++) {
_root.bubbleArray[i].removeMovieClip();
}
}
bVar = track.text;
bubbulate(bVar);
bubbleMoveVar(true);
};

onEnterFrame = function () {
bubbleRoam();
bubbleBounce();
mouseAttract(true);
};

/* Frame Two*/

stageCenterX = Stage.width/2;
stageCenterY = Stage.height/2;

bubbulate = function (bNum) {
_root.bubbleArray = new Array();
for (i=0; i<bNum; i++) {
scale = random(60)+10;
_root.attachMovie("bubble","bubble"+i,i,{_y:stageCenterY, _x:stageCenterX});
_root.bubbleArray.push(_root['bubble'+i]);
_root.bubbleArray[i]._alpha = random(100)+45;
_root.bubbleArray[i]._xscale = scale;
_root.bubbleArray[i]._yscale = scale;
_root.bubbleArray[i].bXMove = 0;
_root.bubbleArray[i].bYMove = 0;
_root.bubbleArray[i].distanceX = Number;
_root.bubbleArray[i].distanceY = Number;
}
}
bubbleMoveVar = function (randomize) {
for (i=0; i<_root.bubbleArray.length; i++) {
if (randomize == true) {
_root.bubbleArray[i].bXMove = random(10)-5;
_root.bubbleArray[i].bYMove = random(10)-5;
if (_root.bubbleArray[i].bXMove == 0) {
_root.bubbleArray[i].bXMove = _root.bubbleArray[i].bXMove+10;
}
if (_root.bubbleArray[i].bYMove == 0) {
_root.bubbleArray[i].bYMove = _root.bubbleArray[i].bYMove+10;
}
} else {
moveX = random(10)+1;
moveY = random(10)+1;
_root.bubbleArray[i].bXMove = moveX;
_root.bubbleArray[i].bYMove = moveY;
}
}
};


bubbleRoam = function () {
for (i=0; i<_root.bubbleArray.length; i++) {
bubbleArray[i]._x = bubbleArray[i]._x+bubbleArray[i].bXMove;
bubbleArray[i]._y = bubbleArray[i]._y+bubbleArray[i].bYMove;
}
};
bubbleBounce = function () {
for (i=0; i<_root.bubbleArray.length; i++) {
if (_root.bubbleArray[i]._x>=550) {
_root.bubbleArray[i].bXMove = _root.bubbleArray[i].bXMove*-1;
}
if (_root.bubbleArray[i]._x<=0) {
_root.bubbleArray[i].bXMove = _root.bubbleArray[i].bXMove*-1;
}
if (_root.bubbleArray[i]._y>=400) {
_root.bubbleArray[i].bYMove = _root.bubbleArray[i].bYMove*-1;
}
if (_root.bubbleArray[i]._y<=0) {
_root.bubbleArray[i].bYMove = _root.bubbleArray[i].bYMove*-1;
}
}
};

detDistanceMouse = function (object1) {
for (i=0; i<_root.bubbleArray.length; i++) {
_root.bubbleArray[i].distanceX = object1._x-_root._xmouse;
if (_root.bubbleArray[i].distanceX<0) {
_root.bubbleArray[i].distanceX = _root.bubbleArray[i].distanceX*-1;
}
_root.bubbleArray[i].distanceY = object1._y-_root._ymouse;
if (_root.bubbleArray[i].distanceY<0) {
_root.bubbleArray[i].distanceY = _root.bubbleArray[i].distanceY*-1;
}
if (_root.bubbleArray[i].distanceY>5) {
_root.bubbleArray[i].bYMove = _root.bubbleArray[i].bYMove*-1;
}
if (_root.bubbleArray[i].distanceX>5) {
_root.bubbleArray[i].bXMove = _root.bubbleArray[i].bXMove*-1;
}
}
};


/* BEGIN INTERACTIVE FUNCTIONS */

mouseAttract = function (active) {
if (active == true) {
for (i=0; i<_root.bubbleArray.length; i++) {
if (_root.bubbleArray[i].hitTest(_root._xmouse, _root._ymouse)) {
detDistanceMouse(bubbleArray[i]);
}
}
}
};

...

Hit Tests & Collisions With As3 (maze)
Forum Geniuses.

I'm working on this for some of my students to learn math, I'm a noob. Your help is beyond appreciated. (The resources currently available for as3 don't address my questions, and I'm stuck - please don't flame me!)

I have a bee and a maze.

I can control the bee with my keyboard.

When the bee collides with the maze I don't want the bee to be able to move.

I have it half-working.

Here is the .fla - any help is appreciated.

~la Swear

Multi Collision Tests?
Lo everyone (esp Klaut in advance )

I know how to do a hit test for two known objects(or object and mouse), is there a bit of code for checking for collision for any object??

Zen

My Movie Tests Ok In IE6, But Not In NETSCAPE...wassup?
I made a page for my movie in Dreamweaver, and I test it in Netscape and i got nothing....please help???

Need Free Online Flash Tests
Hi, guys!

I desperately need an online free test for flash skills but i could not find any I would be very grateful, if anyone could share some links.

Thanks in advance!

[F8] If Tests On Multiple Movie Clips
Hi,

i need an "if" statement where i can test that the x position of the movie clip is where it should be for 5 different movie clips.

if all x positions of the movie clips are correct then it will go to a certian frame otherwise will go to another frame.

The Five movie clips (red, green, orange, blue, yellow)

i tried this but didnt work

compbut.onRelease = function() {
if(red._x=522 && green._x=313.6 && yellow._x=344.95 && orange._x=484.7 && blue._x=410.1)
gotoAndStop("ballooncomp");
}else{
gotoAndStop("balloonfail");
}


Please help

love me xx

New Tweener Class Help With Tests And Bug Report
Hi!!

I developed a new tweener class with nice special FX support!

See some demos on http://thelaborat.org

On the "Projects" topic of the sidebar click on Light Transition to see some tutorials and download the source!

Help me in the project page in order to find bugs and improve the class even more!
Thanxs!!!

Problem With Multiple HitTestObject Tests.
I'm trying to make a simple dodge objects game, with a twist. You only die if you have a head-on collision with an object, and you can "grind" on the left and right sides of your cube for points.

Unfortunately, I've been struggling with this one bug for about 7 or more hours.



When I try to collide with two objects, where the one I should collide with is underneath, I just die. I have no explanation for it, other than it must be a problem with hitTestObject, but I hope this isn't the case, because I can't think of another way to really do it.

I don't think I could explain it by copying and pasting sections of code, so here's the source...

The FLA: http://file-flow.com/download.php?file=762545

I'd really appreciate any help/suggestions/thoughts, I'm fresh out of ideas

Hit Tests Responding To Movies In Buttons
Hi everyone!
I'm trying to make a little game in Flash 8 and I have two movie clips, one that moves left to right and another one inside a button. When the user clicks on the button or hovers over it, it plays a movie clip that is inside. I want the moving clip to 'die' when it reaches the hit area for the movie clip in the button but not when it hits the unclicked button.
So far, I can get the clip to 'die' when it hits the button itself, but not the clip.
So, can anyone help me? Thanks in Advance.

Sorry, if I accidently put this in the wrong forum, I hadn't noticed the Games section and then I wouldn't have known whether it would fall under commands in Flash 8 or games in general...

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