Wtf - This Makes No Sence
I'm making a showcase for my home page, where you will be able to see some of the web pages I've made previously. Watch it here: http://www.hommer.dk/showcase/showcase.html
As you can see the buttons work and the image viewer to the right works as well, but the info box in the bottom doesn't. It shows the same text all the time.
I found out, it has something to do with masking a mc. The info box has a movie clip containing some text that changes. This mc is masked, so the text disappears and some new text comes up with a zoom animation (the mask layer is a shape tweening), but the mc won't change when it is masked (or it changes quick, and then goes back to frame 1). When I remove the masking, there is no problem. Why is that?!
The .fla-file: http://www.hommer.dk/showcase/showcase.fla
KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 12-08-2006, 04:44 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
What Is The Sence Of Scenes?
how can they be used?
I only use a second scene when I build a preloader. Is there a different reason to use more scene?
Sence Problem
i have 3 sence :
"scene a" , "scene b" and "scene c"
How i am locate in "scene c"
and i want to create a button within a movie clip
and use that but to call "scene b" gotoAndPlay(5)
but i cannot do that ,,,, i dont know why
i type my script as follow:
on(press){
gotoAndPlay ( "scene b" , 5 )
}
PLS HELP I REALLY NEED HLPE PLS THX!!!!!!!
I Can't Make Sence Of This..
On the main stage I have 4 movies and 4 buttons. The buttons are set to play the movies by using:
on (release) {
_root.movie1.play();
}
etc..
But no matter what I do only the first movie will play. I can't make sence of it. I use the same buttons with the same code only different movienames. All the movies are duplicates of the first one so they should be ok. And they're all in the same place in the library. It seems like a simple mistake somewhere but I just can't find it. Any hints?
Help With Sence Selction
Help help... I'm trying to build a flash website but have a question... I have no problem getting from scence to scene with button control but I would like one scene to fade out before the next is loaded rather then just jump from to another... can anyone explain to me how to do this?
This Doesn't Make Sence To Me...
ok heres my problum. im editing the script from the tutorial "Building Games in Flash 5 - Part 3 - Enemies and collisions" By David Doull... and everything works fine just that im trying to change the name of the enemy in the actionscript. after changing the word "enemy" to "grr" every single time i could find it, the game still works fine but one of the three enemy ships doesn't have any reaction with the laser
WHY do the other two ships work but one doesn't... i didn't add any script to make it ignore one or anything... all i did was change "enemy" to "grr"
oh by the way i did change it to grr even in the instance/name: thing
...help?
Can Anyone Me Sence Of This Rebbertpenner Easing Equation.
As tweening robert pernner easing. If you look at the fla and press the letter 'B' that's the easing i want to makes the easing ball_Mc ease, it eases to the next location moving in a curve s bend to the next location. I only want the one equation so that i have a two buttons(prob eventauly more) but for an example two btns and when you press on one button the ball_Mc moves to the xpos set and the ypos set. So that all the other code is deleted and only left the math on the ball_mc to make it move the same as if you press the 'B" in the tweenrobpenner.fla
AS3 Makes Me Mad
It's sort of frustrating to find the simplest things to do in AS2 nearly impossible in As3. Here's my problem.
in AS2 I could make a for loop generate 10 movie clips and fill them with a text box + text. I can't find any documentation on how to do this with AS3. If someone has a tutorial that would be awesome.
My second problem is, no matter what I import I keep getting this error...
"1180 call to a possibly undefined method addChild"
My code:
ActionScript Code:
package weee {
import flash.display.*;
import flash.text.*;
public class MainMenu {
public function MainMenu() {
for (var $i=1; $i<=7; $i++) {
var $newMc:MovieClip = new MovieClip();
$newMc.x = 100;
$newMc.y = 30;
$newMc.name = 'btn'+$i;
addChild($newMc);
}
}
}
}
What do I need to import exactly to get addchild to work?
This Makes No Sense
grr..
I'm used to using paths in IF statements at this point, and in my site, I've used it a thousand times. However, this time it won't work and I've triple checked my syntax and path string.
It's organized like this:
_root.varMov.menuMov.menu1.arrowMC_currentframe==2
tellTarget _root.varMov.menuMov.menu1.arrowMC
gotAndStop frame 1
the syntax isn't right here because I'm using normal mode and yes I'm checking it to be an expression. Are there certain times that Flash will not recognize a path? I've used this same method several times in the same way and it has worked.
This Makes Me So Irritated
I guess this really is a STUPID qustion.
I have a movie clip with a button and another mc called displayer (displayer is inside the first mc).Inside the displayer mc i have a dynamic textboks (using the varialble:_root.text) with an animated mask layer over.
So i assign the actions to the button in the first mc:
on (rollOver) {
_root.text = "the tex I want to show";
tellTarget ("displayer") {
play ();
}
}
It all looks good so I tested the movie, and it doesn't work... And yes, I have cheked the font color.
So can anybode help me???
Thanks anyway!
sviig
My SWF Makes IE Freak Out.
I have a very basic movie that is 6 buttons.
You click on a button, it goes to a frame that has that button OFF and all the other buttons on.. click another button, it goes to another frame where its off, all the others on.. etc
this movie works in almost every browser except IE for mac.
buttons randomly disappear, reappear partially, you name it.
might have to hit reload a few times (you'll only see the prob in IE for mac) http://www.kerus.org/DM/
is there any other way to code this? im doing a simple onrelease gotoandstop (frame#).... i dont think coding is even the issue since it DOES work in most browsers..
is there some sort of mac IE workaround that i'm not aware of?
ive been searching and searching and posting everywhere
but either people have no idea what im talking about or simply dont know how to fix it......
Always Makes Me Go Hmmmmmm
why when i put input text boxes and componants in an mc and then put a mask over it,,, u dont see (or indeed use) the text and componants
This Makes Me Go Cracy
hi,
i've got this array:
nav = new Array(180, 220);
and this variable:
rubrik="nav";
xVar = eval(rubrik+"[1]");
or
xVar = eval(eval(rubrik)+"[1]");
trace(xVar); should be 220!
but the output is 'undefined' and i cannot resolve the problem.
any suggestions?
thank you, elastoman
What Makes Don't Work?
Hi, i really headache with flash at the moment, few days ago, i trying to modify the code from flash 4 to higher version. but now it only work with flash player 7. how come flash stupid like that?
The main problem i wish to solve is the attaching problem use alot of CPU resource, almost always 95% or above... can you guys help me to solve that?
thanks alot
yolip
Dreamweaver MX Ftp Makes Me Mad
i just upgraded my Dreamweaver and im having a dificult time finding my local files in the FTP.
i know there is prob a simple setting to show both the local files and the server files but i cant find it...
my ftp ONLY shows 1, but i can chose wich i want... problem is that i cant figure out how to upload to it.
i knwo this is the flash board but i figured most of you gurus out there use dreamweaver as well
Thanks guys...
It Makes Me Ponder.
I question how do people make a grid-styled game, but of course grids require arrays. And that is what I ponder, because, how do they do:
column[0] = [0, 4, 2, 1, 6]
column[1] = [0, 4, 5, 2, 6]
Do you guys know what I mean, you see it all the time especially games that have a level editor mode. I'm asking how do they set up the code so all they have to do is input a number and it generates a piece of land. Like 0 would be a tree and 4 would be grass and 6 will be water for example. Any ideas how people do that. (I think most people on these forums know how to do it, just not me)
Thanks =)!
Tell Me If This Makes Sense To You
i asked this question back in febrauary but could not find the post.
the movie is stopped mid-scene. is there a way to make a button, once clicked, start to play the rest of a scene, then once it gets to the end of the scene, skip to the scene that corresponds with the button that was clicked?
This Makes No Sense
Hello.
Could someone try and explain how this works as it makes no sense to me.
I've created a set of scrolling images in flash 8 that will sit on the index page (created in dreamweaver) of my site.
Ok, so I build the scroll in flash using 'loadMovie' to bring my images into the project from an external folder.
The published .swf file will be in the same folder as my images folder so I set the path for the 'loadMovie' to:
"scroll_photos/scrolling_image_1.jpg", "photo_loading_area"
I test the movie and all works well. Photos load.
Here's the thing.
When I put the .swf file on my index.html page (which is outside of the folder that the flash stuff is in) the photos wont load.
The flash runs on the index page and scrolls but the photos don't get pulled in!!
I have, after a long time, solved the problem by moving the folder of photos (scroll_photos) to my root folder where my index.html page is. I changed nothing in my AS code. The path is the same.
This makes no sense!! My understanding is that the flash .swf file is self contained and runs as a self contained movie. I can see nothing in my index.html page that suggests a different path to the images folder.
Why would the index page affect the loading of my photos in a flash movie if the path to the photos is part of the flash movie?
This isn't helping my learning curve of action script!
Thanks for any explanation.
Julian
What Makes A 'glyph'?
I'm looking into the font embed option. Flash says o.a.:
Quote:
Uppercase [A..Z] (27 glyphs)
Lowercase [a..z] (27 glyphs)
Numerals [0..9] (11 glyphs)
Punctuation [!@#%...] (52 glyphs)
I want to combined all of those so I thought I had to pick:
Quote:
Basic Latin (95 glyphs)
Indeed, in the help files it says about Basic Latin:
Quote:
Basic Latin glyphs within the Unicode range 0x0021 to 0x007E
I've counted them and they are 94 glyphs instead of 95 which flash itself says?
But more strangely: when I add up the uppercase/lowercase/numerals,punctuation number of glyphs about it adds up to 117, not the 95 (94) or Basic Latin which should combine those four? And I thought there where 26 letters in the alfabet, not 27? Am I missing something on how flash defines what is a 'glyph'?
Swf In Swf Makes It Slower...:S?
peepz,
it seems that if i load another smf in my movie it starts running much more slower....
is there a solution to fix this?
load command:
ActionScript Code:
keyFrame = 1;
mcEffecten.removeMovieClip();
mcContainer.loadMovie(overAllLoader+".swf", 200);
trace(overAllLoader);
mc1._visible = false;
mc2._visible = false;
mc3._visible = false;
mc4._visible = false;
mc5._visible = false;
mc3._visible = false;
While That Makes Buttons
I have simple problem thi time, i wanna create buttons from a while.
And it works, but when try to set the value of K in this portion of code:
ActionScript Code:
setPlayers(k, larghezzaArea/2, altezzaArea - bordo);
i always have as value of K=6 in that function, when i want that this while makes five button with vlue:
k =1, k=2, k=3, k=4, k=5
I can manged this problem trying to have the number from the string of Obj, splitting and checking... but it's a dirt job, I don't like this type of solution.
And at the end of day I still don't understand what doesn't work.
ActionScript Code:
k = 1;
while (k <= 5){
Obj = createEmptyMovieClip("interfaccia"+k, k).attachMovie("bottone", "bottone", 0);
Obj._x = 25;
Obj._y = 50+(k*55);
Obj.onRelease = function(){
setPlayers(k, larghezzaArea/2, altezzaArea - bordo);
}
k++
}
I'm sure that i doing some error of logic to using "Obj.onRelease = function()", but I don't understand what type of problem.
anyone have some idea?
Makes Annoying Swf
What are the things that makes the swf stop and annoying?
I mean the stops that is healed when it is low quality
Makes Annoying Swf
What are the things that makes the swf stop and annoying?
I mean the stops that is healed when it is low quality
Help Can't Figure Out What Makes The X Appear
Hi,
I've developed this piece of flash that has music. I just added a mute/play button for the sound on the bottom right hand corner. it works fine except, the microphone image has this X on top of it when i try to test the movie or export it. I can not for the life of me figure out where that X has come from. Could someone take a look and let me know? Is it something that goes automatically with the actionscript play(); and stop();?!
Thanks in advance!
Mp3 Makes My Flash Damn Big...
hi, i want to insert a song in my flash movie! but every time i do this my flash gets f***** big! i saw flash movies with whole songs in it and these files were just 300 kb! how can i do that? hope someone can help me!
ps: sorry for the bad engl. but i'm german! *gg*
*What Makes The Best Flash Site?*
I need help..I wanna make a really sweet flash site..
i dont know where to begin, i know i want it ALL flash
and the name is sub zero 248.
im okay with flash.
can anyone give me some suggestions/tips on what makes a good flash site..i need a color choice too.
thanks alot!
- (A) - (u) - (s) - (t) - (i) - (n) -
Dragging MC Makes Others Disappear...Help
Ok, I have a jigsaw game I am working on, and this is what code I have for each of the Movie Clip pieces:
onClipEvent(mouseDown){
hit=true;
}onClipEvent(mouseUp){
hit=false;
}onClipEvent(enterFrame){
if(this.hitTest(_root._xmouse,_root._ymouse)&&hit= =true){
this._x=_root._xmouse;
this._y=_root._ymouse;
}
}
But every time that I drag one piece of the puzzle over another, the one I just went over disappears! What do I do?
Thank You!
What Makes Pixelfonts Blurry?
minor problem: i am using pixelfonts for my new flash site and it looks really sharp and crisp and nice and all. but there is this one place where a couple of links are placed and they come out all blurry, they have _x and _y that are whole numbers, and i used links just like them in other places and they look fine... just can't figure it out...
thanks
Mask Makes Movie Way Too Big
ive got a clip that is supposed to look like its something being drawn, so i went through and masked it out frame by frame, so when its played, it looks like its being drawn.
i hope that made sense.
anyways, its not too big (as in size on stage), and lasts for about 55 frames. the problem is it makes the movie bigger than huge. is there a way to do what im trying to do that wont add 20 something k to my file?
thanks
Music Makes Me Happy.
ladies and gents.
here's the low' low'
so its time to add a little music to the site ima throwing together.
Anyone want to point me to a good tut' or url, to help me out with this operation. I want 1-2 mp3's, and I want a little movie clip, which has the movements, like the level's on a stereo. You see them all over the web, (little bars, that jump to the beat). Are those just random motion tweens, in a movie, clip that loop?
Help my out friends...
thanks
g g
AAARGH This Makes No Sense
Im putting together my flash webpage, right? And I have a movie loading into a movie clip placeholder during the loading of the page. Then i get to the last frame and the stop action comes into effect. NOW, for no reason my sleep deprived brain can see.... my buttons dont work (they should load other movies into the same placeholder) But they dont even have their down states activated in the movie when you roll over them. But they work when you enable simple buttons in the workspace. AAAARGH! Please someone help. I would really appreciate it. Now i must go beat my head on something.
-webmurk
A.S. 2.0 Makes Swf 50kb Larger Why? HELP
I have a fla that if i publish it with ActionScript 1.0 the swf created is only 48kbs, but if i publish it with ActionScript 2.0 the swf created is a wopping 82kb... What causes this? I don't believe this is normal.. Attached is my size report. Some help would be great. Thanks guys.
A.S. 2.0 Makes Swf 50kb Larger Why? HELP
I have a fla that if i publish it with ActionScript 1.0 the swf created is only 48kbs, but if i publish it with ActionScript 2.0 the swf created is a wopping 82kb... What causes this? I don't believe this is normal.. Attached is my size report. Some help would be great. Thanks guys.
PS i posted this in the actionscript forum with no avail. I never got any responses.
What Makes This Happen With Text?
I've used scrolling text before, using mouse over or mouse down. Each time i've loaded the text from an external txt document. Like this:
http://www.adrianmunsey.com/scroll.html
Why does the text I link have double page breaks in?? My formatted text when tested in Flash is fine, however once exported it adds a page break in. I've played with all the components and tried using soft returns in the txt document but......no good. Basically anyone know why this happens??
GetURL Help. It Makes No Sense.
on (release) {
getURL("www.jaundisband.com","_blank");
}
Now what is wrong with that. I am attempting to link to a friend's band site. When you hit the corresponding button, however, a new browser window opens up with a URL like this:
http://www.nothinglostband.com/www.jaundisband.com
Obviously, the file is hosted on www.nothinglostband.com. I haven't finished all the flash so it isn't a public file, but the URL is:
www.nothinglostband.com/sideframe.html
Click on music, then on the links and you will see this happening. WHY !!!
Someone please shed some light on this for me.
- STP
LoadMovie Makes MC Unclickable?
Hey guys,
I've got this dynamic photo gallery that gets information via XML.
A lot of it's working now and I'm pretty pretty happy =)
Except one thing...
After creating empty movie clips and attaching movie to generate the thumbnails dynamically, I have also used loadMovie so that the created MC gets a thumbnail picture of an external JPEG file. When I do this thought, for some reason the MC becomes unclickable................(That clicking-finger-hand-mouse-icon doesn't appear)
//generates & displays thumbnails for a given root, ie: submenu.
GenerateThumbnails = function(container, name, x, y, root){
//thumb0 is a container so the thumbnails can be removed in one step
var curr_thumb0;
var curr_thumb;
numPics=root.childNodes.length;
curr_thumb0 = _root.createEmptyMovieClip("thumbnails_mc", 100);
for (var i=0; i<(numPics>MAX_THUMBS? MAX_THUMBS: numPics); i++) {
curr_thumb = curr_thumb0.attachMovie("thumbitem", "thumb"+i+"_mc", 100+i);
curr_thumb._width=THUMB_SIZE;
curr_thumb._height=THUMB_SIZE;
curr_thumb.loadMovie(root.childNodes.attributes.na me);
//THIS LINE ABOVE MAKES THE curr_thumb MC UNCLICKABLE...............=(
curr_thumb.trackAsMenu=true;
curr_thumb.link = root.childNodes.attributes.vars;
curr_thumb.onPress = function(){
trace(this.link);
_root.img_mc.loadClip("this.link", "loadImgHere");
}
}
If I take out the loadMovie line, the MC (of course doesn't have a thumbnail picture on it but) is clickable.
Can anyone help me please? =)
LoadMovie Makes Me CRAZY
Alright, I danced around these forums for a while and didn't find anything that quite got to the bottom of my problem. As always, if I've missed something and a similar problem has been addressed, I do apologize.
I have a large swf (seething with images at nearly 9mb) that I'm trying to break down into more manageable chunks so if someone’s not there to look at the pictures, they don’t have to load them. The site (the giant, working version) is live, here.
All of the sections are pooled together within a movie clip that has a series of frames which contain the commands to load the external movie. When I want to access a section, I tell the playhead in the mc containing all the sections to move to the frame that will tell the target mc to load it’s movie. (If this seems like a strange way to do it, my bad. I had to change my strategy partway through and this was all already in place so I just worked around it.)
There is a preloader which is supposed to display a rough progress bar and retract a cover to reveal the section once it has loaded.
This all works swimmingly offline – exactly as it should. But when I upload it, it goes crazy! I believe the files load successfully every time, but the progress bar, more often than not, will remain inert; sometimes indefinitely. A lot of the time it will sit for roughly 10 seconds, then all of a sudden work properly, load the section and retract as planned. Sometimes, when I dump everything and reload it, it works just fine! IT’S SO RANDOM.
I sent the getBytesLoaded/Total data to a dynamic text box so I could see the variables online and, when the program would malfunction, the output generally read “0/-1.” I get the sneaking feeling this is the source of all my problems. If you know why an externally-loaded mc’s progress would ever read like that please tell me!
I’ve had nothing but problems from my host since I got the service. While my issues were always with logging in and file transfer, I won’t rule out their poor performance so far as the cause.
I hope that explains it clearly enough, and for the love of god help me because I’ve been trying to get this to work for a while now to no avail. The site works as a whole, but it would be 10x better if I could load the larger chunks optionally. Thanks in advance for your help!
Music Makes Animation... How? :(
Hi, My name is Jack, I'm new here.
I have a question, I want to make a kind of a jukebox, it would be on a website, and anybody can upload their wav or mp3 file to it, the box would make many strange and funny things while plaing the music file, but there is one thing that I have no idea how to make- there are a couple of "people" in the box, and I want them to dance (animation), when the uploaded music is played, not while all the track, because there can be a silent moment in it, the animation (dancing) would have to "check" if there is any sound now played, and stop if there would be silence (a silent moment in the music file)...
Any ideas how to make it? )))
Regards, Jack.
[F8] Customizing A .fla Makes It Bigger?
I'm changing some text in a .fla file I received from a client. Together with the .fla files, I've also received the original .swf files. However, when I change the text & export new .swf's, they're substantially bigger (in file size) than the originals. An original .swf of 29 kb will - after translation - be 37 kb.
This even happens with files that have no .jpeg files.
If I export them to Flash Player 6, they're a bit smaller - since some of the newer fill functions aren't supported in FP6, they're ignored by the compiler.
Any idea what I can do?
I Have A Function That Makes An MC Hover....now Ho
Basically, I have a function that is telling this piece of text to move around. When someone rolls over the text however, I'd like for this function to stop. And when someone rolls off of the text, I want it to continue.
How can I do this?
Thanks.
function floatMc(float_mc:MovieClip, range_num:Number, frames_num:Number):Void {
var xMin:Number = float_mc._x-range_num;
var xMax:Number = float_mc._x+range_num;
var yMin:Number = float_mc._y-range_num;
var yMax:Number = float_mc._y+range_num;
var frames:Number = frames_num;
//number of seconds for the tween to take, and how often to start a new tween
var me:MovieClip = float_mc;
function newTween() {
//adjust the easing class as needed
var xNew:Number = (Math.random()*(xMax-xMin))+xMin;
var yNew:Number = (Math.random()*(yMax-yMin))+yMin;
xTween = new mx.transitions.Tween(me, "_x", mx.transitions.easing.Regular.easeInOut, me._x, xNew, frames, false);
yTween = new mx.transitions.Tween(me, "_y", mx.transitions.easing.Regular.easeInOut, me._y, yNew, frames, false);
}
var IntID:Number = setInterval(newTween, (frames*(1000/31)));
}
floatMc(penthouse, 12, 62);
This Makes No Sense Alpha+=.1 Is Doing +.097
addEventListener("enterFrame", watchMouse);
function watchMouse(e:Event) {
if (mouseX>0 && mouseX<383 && mouseY>0 && mouseY < this.height) {
if (tinty.alpha<1) {
trace("beforeAlpha:"+tinty.alpha);
tinty.alpha+=.1;
trace("afterAlpha:"+tinty.alpha);
}
} else {
if (tinty.alpha>0) {
tinty.alpha-=.1;
}
}
}
And then it traces:
beforeA:0
afterA:0.09765625
This makes no sense!!!
Fullscreen Makes My Swf Go 4x Faster
Hello!
I have made a application in cs3 that has a lot of moving things and an own animator. When I just play my movie I get 60fps, then I switch to fullscreen and back to normal mode when I suddenly get 240fps!
That is when I am using Firefox, in IE there is no difference.
Anyhow ever heard of this and knows how to always get the better performance? ( Or just have some ideas why it is like this )
Thanks!
Script Makes Everything Run Slow. [AS2]
Hi, I'm currently doing a project for school; I'm following a tutorial on tutorialized com, it is the "Security" game.
I use Adobe Flash CS3 and Action Script 2.0
When I press Ctrl+Enter or Publish or even Export it; when played it crashes.
Well; semi-crashes. After a while it will come up with a confirmation box saying something like:
A script is causing Flash to run slow and could cause your PC to run slow, would you like to abort the script.
If I clicked no, it would do the same thing again. If I click Yes, it aborts the script, of which I have suspicion on it being the movement script for the main character, because afterwards the character cannot move.
I have two security gaurds following a motion guide aswell if that helps.
Here is the current script for the character:
Code:
onClipEvent (load) {
power = 1;
radius = 6.5;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= power;
}
if (Key.isDown(Key.RIGHT)) {
_x += power;
}
if (Key.isDown(Key.UP)) {
_y -= power;
}
if (Key.isDown(Key.DOWN)) {
_y += power;
}
while (_root.levels.wall.hitTest(_x, _y+radius, true)) {
_y--;
}
while (_root.levels.wall.hitTest(_x, _y-radius, true)) {
_y++;
}
while (_root.levels.wall.hitTest(_x-radius, _y, true)) {
_x++;
}
while (_root.levels.wall.hitTest(_x+radius, _y, true)) {
_x--;
}
if (_root.levels.exit.hitTest(_x, _y, true)) {
_root.levels.gotoAndStop(2);
}
}
Thanks
[CS3] Loop Makes An Array
i have a very nice array:
PHP Code:
var mcs:Array = new Array();
for (var i = 0; i <= 11; i++) {
mcs[i - 1] = "mc" + i;
}
This loop makes:
mc1, mc2, mc3, mc4, mc5, mc6, mc7, mc8, mc9, mc10, mc11
I want it to make:
mc01, mc02, mc03, mc04, mc05, mc06, mc07, mc08, mc09, mc10, mc11
...how do i do that?
Also can the "11" in the loop be a var saved in a separate .as file?
How do I turn the code below into a loop that does the same as thing but changes depending on the var (11) mentioned above...so if the var was 100 it would do this code for up to "mc100"
PHP Code:
onEnterFrame = function(){
mc02._x = mc01._x+mc01._width+8
mc03._x = mc02._x+mc02._width+8
mc04._x = mc03._x+mc03._width+8
mc05._x = mc04._x+mc04._width+8
mc06._x = mc05._x+mc05._width+8
mc07._x = mc06._x+mc06._width+8
mc08._x = mc07._x+mc07._width+8
mc09._x = mc08._x+mc08._width+8
mc10._x = mc09._x+mc09._width+8
}
thank you for your help
XClassEventListener, Does It Makes Sens For You?
Hi,
I've done a class to be able to listen to the event for a CLASS not on an instance.
ActionScript Code:
class net.webbymx.events.XClassEventListener {
/* *****************************************************************************
* PRIVATE STATIC VARIABLES
***************************************************************************** */
private static var $instance:XClassEventListener = undefined;
private static var _oListeners:Object;
/* *****************************************************************************
* CONSTRUCTOR
***************************************************************************** */
private function XClassEventListener() {}
/* *****************************************************************************
* PUBLIC STATIC FUNCTIONS
***************************************************************************** */
public static function initialize(obj:Object):Void {
if ($instance == undefined) $instance = new XClassEventListener;
// obj.dispatchEvent = $instance.dispatchEvent;
// obj.eventListenerExists = $instance.eventListenerExists;
obj.addEventListener = $instance.addEventListener;
obj.removeEventListener = $instance.removeEventListener;
// obj.removeAllEventListeners = $instance.removeAllEventListeners;
}
/* *****************************************************************************
* PRIVATE STATIC FUNCTIONS
***************************************************************************** */
public static function dispatchEvent(eventObj:Object) {
trace("Dispatch Called");
// check if the object has the good properties
if (eventObj.target == undefined || eventObj.clazz == undefined || typeof(eventObj.clazz) != "string" ||
eventObj.type == undefined || typeof(eventObj.type) != "string") return;
// What for?
//this[eventObj.type + "Handler"](p_eventObj);
/*_global.ASSetPropFlags(eventObj.target.__proto__.constructor,null,6,true);
for (var prop:String in eventObj.target.__proto__.constructor) {
trace(prop+": "+eventObj.target.__proto__[prop]);
trace(eventObj.target.__proto__[prop].toString());
}*/
// check is the class end event is registered
if (_oListeners[eventObj.clazz] == undefined || _oListeners[eventObj.clazz][eventObj.type] == undefined) return;
// list object and call the function
for (var i:String in _oListeners[eventObj.clazz][eventObj.type]) {
var o:Object = _oListeners[eventObj.clazz][eventObj.type][i].o;
var oType:String = typeof(o);
var f:String = _oListeners[eventObj.clazz][eventObj.type][i].f;
if (oType == "object" || oType == "movieclip") {
if (o.handleEvent != undefined && f == undefined) {
o.handleEvent(eventObj);
} else {
if (f == undefined) f = eventObj.type;
o[f](eventObj);
}
} else { // function
//o.apply(p_dispatchObj,[eventObj]);
}
}
}
// internal function to locate listeners:
private static function $indexOfListener(listeners:Array,obj:Object,func:String):Number {
var l:Number = listeners.length;
var i:Number = -1;
while (++i < l) {
var tmpObj:Object = listeners[i];
if (tmpObj.o ==obj && func == undefined) return i;
else if (tmpObj.o ==obj && tmpObj.f == func) return i;
}
return -1;
}
/* *****************************************************************************
* PRIVATE FUNCTIONS
***************************************************************************** */
/**
* Add a listener for an event, for a class
* @param p_event: String
* @param p_obj: Function (Class.prototype)
* @param p_function: String
*/ // OK
private function addEventListener(event:String, clazz:String, func:String):Void {
if (_oListeners == undefined) { _oListeners = {}; /*_global.ASSetPropFlags(this,_oListeners,1);*/ }
// creating a new object for each class holding the events
if (_oListeners[clazz] == undefined) _oListeners[clazz] = {};
// creating a array (same name as the function) holding the obj (ref, callbackfunction)
if (_oListeners[clazz][event] == undefined) _oListeners[clazz][event] = [];
// check if the object is already in the array, if not pushing it
if ($indexOfListener(_oListeners[clazz][event],this,func) == -1) _oListeners[clazz][event].push({o:this,f:func});
}
/**
* Remove the listener for an event, for a class
* @param p_event: String
* @param p_obj: Function (Class.prototype)
* @param p_function: String (optional)
*/
private function removeEventListener(event:String, clazz:String):Void {
trace(_oListeners);
for (var i:String in _oListeners) {
trace(i+": "+_oListeners[i]);
}
var func:String = arguments[2];
// go out of the function if either the class is not registered nor the event for the class
if (_oListeners == undefined || _oListeners[clazz] == undefined || _oListeners[clazz][event] == undefined) return;
/* find the index for the object. If the function is pass as the parameter we will delete just the instance holding this callback
function for this class, else we will delete all the instance */
var index:Number;
if (arguments[2] != undefined) {
index = $indexOfListener(_oListeners[clazz][event],this,func)
if (index != -1) _oListeners[clazz][event].splice(index,1);
}
else {
while ( (index = $indexOfListener(_oListeners[clazz][event],this)) != -1) {
_oListeners[clazz][event].splice(index,1);
}
}
if (index != -1) {
if (_oListeners[clazz][event].length == 0) delete _oListeners[clazz][event];
if (_oListeners[clazz].length == 0) delete _oListeners[clazz];
}
}
private function removeAllEventListener(event:String, clazz:String):Void {
// go out of the function if either the class is not registered nor the event for the class
if (_oListeners == undefined || _oListeners[clazz] == undefined || _oListeners[clazz][event] == undefined) return;
delete _oListeners[clazz][event];
if (_oListeners[clazz].length == 0) delete _oListeners[clazz];
if (_oListeners.length == 0) delete _oListeners;
}
private function removeClassListener(clazz:String):Void {
// go out of the function if either the class is not registered nor the event for the class
if (_oListeners == undefined || _oListeners[clazz] == undefined) return;
delete _oListeners[clazz];
}
}
Simple eg:
ActionScript Code:
import net.webbymx.events.XClassEventListener;
[Event "test"]
class net.webbymx.test.DClass {
function DClass(){
trace("DCLass instance created");
};
public function Dpatch() {
var o:Object = new Object();
o.target = this;
o.type = "test";
o.clazz = "net.webbymx.test.DClass";
XClassEventListener.dispatchEvent(o);
}
}
in the fla
ActionScript Code:
import net.webbymx.events.XClassEventListener;
import net.webbymx.test.DClass;
XClassEventListener.initialize(this);
this.addEventListener("test", "net.webbymx.test.DClass", "atest");
var d1:DClass = new DClass();
var d2:DClass = new DClass();
var d3:DClass = new DClass();
var d4:DClass = new DClass();
// test dispatching
d1.Dpatch();
function atest(evtObj) {
trace("callback done");
trace(evtObj.clazz);
this.removeEventListener("test", "net.webbymx.test.DClass");
}
why did I do this.
It cames with my rugby game.
I have player in two teams. The player are instance of the same class.
When a player throw the ball I want the other teammate to act like "wait for ball" and the opponent like "seek for ball"
so in my team I can do
ActionScript Code:
XClassListener.initialize(this);
this.addEventListener("throw", "net.webbymx.game.Player", "wait");
and in my opponent team I can do
ActionScript Code:
XClassListener.initialize(this);
this.addEventListener("throw", "net.webbymx.game.Player", "seek");
Does it makes sens for you ????
Any feedbacks/comments are welcome
Cheers
<b> Tag Makes Text Disappear
I have a text field that is filled in dynamically from a txt file. I turned on the "Render text as HTML" property but when I add the tag, the text in the tag disapears!
Why? How do I make it work?
This Makes <undefined> Sense To Me
Hi,
I have verified that:
undefined>1 returns undefined
undefined==1 returns false
(which is not exactly what I would expect but is ok, since undefined evaluates as false in conditional expressions (doesn't it?))
So, it is quite comforting to see that:
(undefined>1 || undefined==1) returns false
Now, can anyone in the earth explain me why the heck:
undefined>=1 RETURS TRUE!??!!!????????!!!!!!!!!??????????
Try it if you don't believe it.
All this holds if you replace every ">" with a "<".
I am puzzled. Any idea?
Bye
Teo
Help Me Makes BOUNDRIES On My .fla File
Hi, im trying to make a file that you can controll a ball (ball_mc) around with your arrow keys and has to stop when it reaches a certain point which i have marked as a black square around it.
Heres the as in my frame:
Code:
var speed:Number = 3;
ball_mc.onEnterFrame = function() {
if (Key.isDown(Key.RIGHT)) {
this._x = this._x+speed;
} else if (Key.isDown(Key.LEFT)) {
this._x = this._x-speed;
}
if (Key.isDown(Key.UP)) {
this._y = this._y-speed;
} else if (Key.isDown(Key.DOWN)) {
this._y = this._y+speed;
}
}
any suggestions ???
|