Mx Api Stuff

I was playing around with api and I came up with this, kinda looks like the pictures where they leave the camera shutter open :slight_smile:


_root.createEmptyMovieClip("bob",0);
while(i<40){
	bob.duplicateMovieClip("bob"+i,i)
	eval("bob"+i).moveTo(Math.random()*550,Math.random()*400);
	eval("bob"+i).lineStyle(Math.random()*3,Math.random() * 255 << 16 | Math.random() * 255 << 8 | Math.random() * 255,Math.random()*50+50);
	++i;
}
onEnterFrame = function(){
	for(x=0;x<40;++x){
		eval("bob"+x).clear()
		eval("bob"+x).moveTo(Math.random()*550,Math.random()*400);
		eval("bob"+x).lineStyle(Math.random()*3,Math.random() * 225 << 16 | Math.random() * 255 << 8 | Math.random() * 255,Math.random()*100);	
		//eval("bob"+x).lineTo(_xmouse,_ymouse);
		eval("bob"+x).curveTo(_xmouse,_ymouse,(550/2),50);
	}
}

Yeah just think it looks cool…hehe :slight_smile:

Very neato. Although you should add

_root.createEmptyMovieClip(“bob”, 1);

to the beginning of that code. That is…if you are posting that for copy and paste.

hehe ooops i forgot to paste that part…oh well hehe :slight_smile:

Hey Bezzer, you could propose this for the 25-line Actionscript contest!

pom :asian:

Hmm, that is a good idea!

By the way, it didn’t work until I put createEmptyMovieClip(“bob”,-1). Which is logical because you duplicate your first clip at depth 0.

pom :asian:

yeah that was what i was trying to make it for hehe…but i dun think i’ll enter…i’ve seen the other peoples stuff…To good for me :slight_smile:

hrmmm i’ll look into the thing u had to change…i think i should start off at 1 :slight_smile:

Don’t be shy, man! But it’s true that this Russian guy just made a 3D dog in 21 lines, and I don’t how anyone can beat that…

pom :asian:

wow which entry is that? hehe i wanna see the 3d dog…

One of the last ones, check it on the forums. From deliMIter. That guy is totally amazing, absolutely brilliant. But don’t look at the source, it’s worse than Chinese :stuck_out_tongue:

pom :asian:

WOW, that delimeter guy is amazing as well. Although I think his code was too long to be in the contest…not sure how you count the lines though.

Anyways, I love how he uses the “?:” if/else statement. It is so much more efficient. I use it in Javascript all the time.

I pretty much understood his code up to here…

function fromAtoB(A, B) {
// the next block is one line //
if (typeof (A) == “movieclip”) {
for (var i = 1; i<(iLimit=Math.round(Math.sqrt((A.X-B.X)(A.X-B.X)+(A.Y-B.Y)(A.Y-B.Y)+(A.Z-B.Z)(A.Z-B.Z))/((A._radius+B.radius)/4))); i++) {
createClip(A.name+""+i+"
"+B._name, ++_depth, Math.round((A._color & 0xFF)
(iLimit-i)/iLimit) | Math.round(((A._color >> 8) & 0xFF)(iLimit-i)/iLimit) << 8 | Math.round(((A._color >> 16) & 0xFF)(iLimit-i)/iLimit) << 16 | Math.round((B._color & 0xFF)i/iLimit) | Math.round(((B._color >> 8) & 0xFF)i/iLimit) << 8 | Math.round(((B._color >> 16) & 0xFF)i/iLimit) << 16, (A._radius(iLimit-i)/iLimit+B._radiusi/iLimit)2Math.pow(Math.abs(i-iLimit/2), 1/3)/iLimit+10, {X:_zx=A.X+i(B.X-A.X)/iLimit, Y:_zy=A.Y+i*(B.Y-A.Y)/iLimit, Z:_zz=A.Z+i*(B.Z-A.Z)/iLimit, R:Math.sqrt(_zx*_zx+_zy*_zy+_zz*_zz)}, true);
}
}
// end of block //
}

Then it all went downhill from there…haha.

hrmm i can only see the lightnening one and the mouse fire thing from him…can u post a link to his dog please? :slight_smile:

I had a look at some of urs pom…or at least i think there urs…hehe

There really good :slight_smile:

He called it a molecular alcoholic pet…haha. It is incredible though. To think that nothing was drawin the making of this. His code is astounding too.

http://www.station4net.com/flashfx/057-25-lines.html

There is a link to it.

Thanks Bezzer :slight_smile:

And about the line count, the worse thing is that his code is perfectly valid. You see, with MX, lots of functions create, attach or dulpicate an object, and they also return a reference to that object. So for instance, you could write:

_root.createEmptyMovieClip("holder",-1);
_root.holder.createTextField("myText",0,0,0,20,10).
_root.holder.myText.text="Flash rocks";

But you could also do it like:

_root.createEmptyMovieClip("holder",-1).createTextField("myText",0,0,0,20,10).text="Flash rocks";

You see how it works?

pom :slight_smile:

didn’t know you could do that…thats a pretty nice trick…gotta love dot syntax :slight_smile:

i’ve been trying to make my code like that… i want to make these lines


eval("bob"+x).clear()
		eval("bob"+x).moveTo(Math.random()*550,Math.random()*400);
		eval("bob"+x).lineStyle(Math.random()*50,Math.random() * 225 << 16 | Math.random() * 255 << 8 | Math.random() * 255,Math.random()*100);	
		eval("bob"+x).curveTo(_xmouse,_ymouse,(419.6/2),50);

into this…


eval("bob"+x).clear().moveTo(Math.random()*550,Math.random()*400).lineStyle(Math.random()*50,Math.random() * 225 << 16 | Math.random() * 255 << 8 | Math.random() * 255,Math.random()*100).curveTo(_xmouse,_ymouse,(419.6/2),50);

but it doesn’t seem to work…i think im not understanding things right…

Wow, gotta love that confuscated (? I think this is the word) code.

Hey Bezzer:

_root.createEmptyMovieClip("<B>holder</B>",-1);
_root.<B>holder</B>.createTextField(“myText”,0,0,0,20,10).
_root.<B>holder</B>.myText.text=“Flash rocks”;

See how the name of the created movie clip is used it all of the other statements. It is written with a locator (aka _root). Now if I understand Ilyas correctly, instead of typing _root.holder all the time you can just attach it to the end of the createEmptyMovieClip command.

I noticed the code you have doesn’t contain the locator, possibly that is why it is not working.

well eval(“bob”+x) is th locator…it gives it the name of a duplicated movie… so yeah i dont know why it doesn’t work… :frowning:

Maybe I should have specified, oops:) I meant the locator as in _root or _parent. I think that might be when it works.