[Flashcoders] weird infinite scroller issue with preview link
http://dnecklesportfolio.com/transfer/kennycole_videopage3.html Keep your mouse on the right hand side and let it scroll all of a sudden you will a button or two thats lit up start to come into view. this totally totally should not happen. anyone have any suggestions.. the fla is there http://dnecklesportfolio.com/transfer/kennycole_videopage3.fla and it uses tweener... _ Share life as it happens with the new Windows Live. http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] buttons lined up next to each other- rollout not work
Try using a variable local to the for loop for the target: //this also sets the event handling in one shot for (i=0; i5; i++) { clipName = this[clip+i]; var myTarget= _root[text+i] trace(target); clipName.onRollOver = function() { Tweener.addTween(this.person,{_alpha:100, delay:0, time:2}); Tweener.addTween(this.whiteborder,{_alpha:100, delay:0, time:2}); Tweener.addTween(myTarget,{_alpha:100, delay:0, time:2}); trace(onrollover+myTarget); }; clipName.onRollOut = function() { Tweener.addTween(this.person,{_alpha:30, delay:0, time:1}); Tweener.addTween(this.whiteborder,{_alpha:0, delay:0, time:1}); Tweener.addTween(myTarget,{_alpha:0, delay:0, time:2}); }; } My guess is target is declared outside the for loop, so you're having some problems with closure. I don't know if AS's closure works the same way as C#'s, but if it does then this could be the problem. This article is specific to C#, but it does a good job of going over how closures and anonymous methods work, and might be helpful to understand this (assuming I'm right in that AS's behavior matches C#'s for closure) http://www.theserverside.net/tt/articles/showarticle.tss?id=AnonymousMethods search for the Captured local variables and code visibility section for an example of the possible differences between what you have and what I suggested. -Andy On Jan 16, 2008 2:13 AM, Dwayne Neckles [EMAIL PROTECTED] wrote: OK on rollover the correponding text clip fades in on rollout it fades out.. during debuging.. all of the targets are text4 and it shouldnt be.. clip0 should control text0 and etc.. but what happens is that clip0 to clip4 controls text4... which is wrong, any suggestions? Code below: //this also sets the event handling in one shot for (i=0; i5; i++) { clipName = this[clip+i]; target= _root[text+i] trace(target); clipName.onRollOver = function() { Tweener.addTween(this.person,{_alpha:100, delay:0, time:2}); Tweener.addTween(this.whiteborder,{_alpha:100, delay:0, time:2}); Tweener.addTween(target,{_alpha:100, delay:0, time:2}); trace(onrollover+target); }; clipName.onRollOut = function() { Tweener.addTween(this.person,{_alpha:30, delay:0, time:1}); Tweener.addTween(this.whiteborder,{_alpha:0, delay:0, time:1}); Tweener.addTween(target,{_alpha:0, delay:0, time:2}); }; } Date: Tue, 15 Jan 2008 21:32:41 -0800 To: flashcoders@chattyfig.figleaf.com From: [EMAIL PROTECTED] Subject: Re: [Flashcoders] buttons lined up next to each other- rollout not work No such problem here with either adjacent or overlapping buttons. Please post your code. Here's mine for four buttons named btn1, btn2, etc.: for (i = 1; i 5; i++) { this[btn + i].onRollOut = function() { trace(this._name); }; } Marc At 09:06 PM 1/15/2008, you wrote: This is probably a classic issue.. I have 5 buttons lined up next to each with no space between but they arent overlapping. I have rollover and rollout events.. but the rollout event doesnt work when i roll over to the next button.. the onrollout event works only when i rollout on to negative space..which sucks is there a workaround ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _ Share life as it happens with the new Windows Live. http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Animating NativeWindows in AIR
Hi List, Couple of questions about AIR and NativeWindows. - How do i set the width and height of an NativeWindow? Can i do that in the code or only in the descriptor file? - Can a NativeWindow also be an MovieClip (living in the library with linkage) and how do i set this? - Can a NativeWindow be composed of multiple movieclips? - Is it possible to animate an NativeWindow (using third party classes like Tweener) What i would like to accomplish is this: The AIR app launches in a certain width and height but when i click a button, the app unfolds to a bigger version with the content, can i, at certain times set the size of my NativeWindow bigger? (The problem that i dont want is that when my app unfolds, my 'appllication canvas' is actuly bigger that what the user sees. When you dragg the app i want the draggeble area to be confined to the size of the current stat of my application) Help is appreciated :) Cheers, Sidney ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] weird infinite scroller issue with preview link
hey anyone gad a chance to take a peek at this.. From: [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Date: Wed, 16 Jan 2008 08:13:02 + Subject: [Flashcoders] weird infinite scroller issue with preview link http://dnecklesportfolio.com/transfer/kennycole_videopage3.html Keep your mouse on the right hand side and let it scroll all of a sudden you will a button or two thats lit up start to come into view. this totally totally should not happen. anyone have any suggestions.. the fla is there http://dnecklesportfolio.com/transfer/kennycole_videopage3.fla and it uses tweener... _ Share life as it happens with the new Windows Live. http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _ Make distant family not so distant with Windows Vista® + Windows Live™. http://www.microsoft.com/windows/digitallife/keepintouch.mspx?ocid=TXT_TAGLM_CPC_VideoChat_distantfamily_012008___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] weird infinite scroller issue with preview link
On Jan 16, 2008 10:25 AM, Dwayne Neckles [EMAIL PROTECTED] wrote: hey anyone gad a chance to take a peek at this.. I didnt see the problem. I let it scroll both left and right for a while but it never did anything untoward...? .m ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] using graphics from flash 8 with flex 2 sdk
Thanks a lot to all who replied, and especially to Glen. This article at bit-101.com is great! Among other things, I'm trying to find new way to collaborate with designers who create graphics in Flash IDE (8 or 9). And so far it seems I've found it. -- -- Best regards, GregoryN http://GOusable.com Flash components development. Usability services. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] using graphics from flash 8 with flex 2 sdk
It's really nice once you get to grips with stuff. Things to remember: When you create an instance of an asset, you should cast it when you create it - I had all sorts of problems and was having to create my assets as children of Sprites until I discovered this: var myMC:MovieClip = new ImportedMCAsset() as MovieClip; You can import sounds, but I have not managed to embed sounds in a MovieClip and get it working, there was something somewhere which mentioned trying to cast the MC as a SoundAsset, but this is how I got it working: [Embed (source = ../resources/sounds/bomb.mp3)] private var SndBomb:Class; var bomb:SoundAsset = new SndBomb() as SoundAsset; You can also embed fonts from the system: [Embed(systemFont=Tahoma, fontName='TextFont', fontWeight='bold', unicodeRange='U+002C-U+005A', mimeType='application/x-font') ] private var AnotherClass:Class; Or from a library: [Embed(source=../library/tahomabd.ttf, fontName='myFont', fontWeight='bold', unicodeRange='U+002A-U+002A', mimeType='application/x-font') ] private var AssetClass:Class; And use it like this - even if you embed the font in the main class and access it in a child clip (not sure if this works for other clips): var label:TextField = new TextField(); var format:TextFormat = new TextFormat(); format.font = TextFont; format.bold = true; format.color = 0xFF; label.htmlText = Embedded fonts; label.embedFonts = true; label.setTextFormat(format); addChild(label); HTH Glen Gregory N wrote: Thanks a lot to all who replied, and especially to Glen. This article at bit-101.com is great! Among other things, I'm trying to find new way to collaborate with designers who create graphics in Flash IDE (8 or 9). And so far it seems I've found it. -- Glen Pike 01736 759321 www.glenpike.co.uk http://www.glenpike.co.uk ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] placing mc on the stage
Hello i got this code: this.createEmptyMovieClip(canvas,this.getNextHighestDepth()); //creates an empty MC in which i attach 2 textMCs canvas._x = random500;//should place the MCs to a random position when they load but it doesn't work?!?-What is wrong here? canvas._y = random100; attachMovieInterval = setInterval(attachMovies, 200);//set interval for green mc reload function attachMovies() { for (var i = 0; i2; i++) { canvas.attachMovie(code,code+i,this.getNextHighestDepth()); canvas.code1._x = random500; canvas.code1._y = random100; canvas.code2._x = Stage.width/2; canvas.code2._x = Stage.height/2;//how do i do to define the x and y position of each mc separately? } } sorry for writing it so briefly. My keyboard doesn't work well and i cannot type a lot - -- Pedro D.K. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Google Analytics ga.js Update
Hey guys I was working on updating my script for the new Google Analytics ga.js code. Can some one tell me what I might be missing in my code? My actionscript: function tracking(page) { import flash.external.ExternalInterface; ExternalInterface.call(pageTracker._ trackPageview(' + page + ');); } tracking(/flash/home); Google's Javascript: script type=text/javascript var gaJsHost = ((https: == document.location.protocol) ? https://ssl.; : http://www.;); document.write(unescape(%3Cscript src=' + gaJsHost + google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E)); /script script type=text/javascript var pageTracker = _gat._getTracker(UA-2876431-9); pageTracker._initData(); pageTracker._trackPageview(); /script Thanks in advance! -- -cb http://blog.projectx4.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] placing mc on the stage
Hi Pedro, Try this instead: Math.random()*500; Here's a simplistic but clear tutorial on the subject: http://animation.about.com/od/flashanimationtutorials/ss/mathrandom.htm hth, Bob Pedro Kostelec wrote: Hello i got this code: this.createEmptyMovieClip(canvas,this.getNextHighestDepth()); //creates an empty MC in which i attach 2 textMCs canvas._x = random500;//should place the MCs to a random position when they load but it doesn't work?!?-What is wrong here? canvas._y = random100; attachMovieInterval = setInterval(attachMovies, 200);//set interval for green mc reload function attachMovies() { for (var i = 0; i2; i++) { canvas.attachMovie(code,code+i,this.getNextHighestDepth()); canvas.code1._x = random500; canvas.code1._y = random100; canvas.code2._x = Stage.width/2; canvas.code2._x = Stage.height/2;//how do i do to define the x and y position of each mc separately? } } sorry for writing it so briefly. My keyboard doesn't work well and i cannot type a lot - -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] placing mc on the stage
Pedro, Is this what you're going for? function attachMovies() { for (var i = 0; i2; i++) { var mc = canvas.attachMovie(code,code+i,this.getNextHighestDepth()); mc._x = Math.random()*500; mc._y = Math.random()*100; } } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pedro Kostelec Sent: Wednesday, January 16, 2008 2:53 PM To: Flash Coders List Subject: [Flashcoders] placing mc on the stage Hello i got this code: this.createEmptyMovieClip(canvas,this.getNextHighestDepth()); //creates an empty MC in which i attach 2 textMCs canvas._x = random500;//should place the MCs to a random position when they load but it doesn't work?!?-What is wrong here? canvas._y = random100; attachMovieInterval = setInterval(attachMovies, 200);//set interval for green mc reload function attachMovies() { for (var i = 0; i2; i++) { canvas.attachMovie(code,code+i,this.getNextHighestDepth()); canvas.code1._x = random500; canvas.code1._y = random100; canvas.code2._x = Stage.width/2; canvas.code2._x = Stage.height/2;//how do i do to define the x and y position of each mc separately? } } sorry for writing it so briefly. My keyboard doesn't work well and i cannot type a lot - -- Pedro D.K. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Google Analytics ga.js Update
Corban, This may just be a typo in your email, but there was a space between the underscore and trackPageview. More to the point, did you try this syntax: ExternalInterface.call(pageTracker._trackPageview, page); See: Programming ActionScript 3.0 / Flash Player APIs / Using the external API / Using the ExternalInterface class -Jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter Sent: Wednesday, January 16, 2008 3:00 PM To: Flash Coders List Subject: [Flashcoders] Google Analytics ga.js Update Hey guys I was working on updating my script for the new Google Analytics ga.js code. Can some one tell me what I might be missing in my code? My actionscript: function tracking(page) { import flash.external.ExternalInterface; ExternalInterface.call(pageTracker._ trackPageview(' + page + ');); } tracking(/flash/home); Google's Javascript: script type=text/javascript var gaJsHost = ((https: == document.location.protocol) ? https://ssl.; : http://www.;); document.write(unescape(%3Cscript src=' + gaJsHost + google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E)); /script script type=text/javascript var pageTracker = _gat._getTracker(UA-2876431-9); pageTracker._initData(); pageTracker._trackPageview(); /script Thanks in advance! -- -cb http://blog.projectx4.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Google Analytics ga.js Update
I was trying to make it an easy call to the function from anywhere in the site. Thats why I created the function. I was hoping to just keep from having to write both lines all over the site. On Jan 16, 2008 2:17 PM, Jim Robson [EMAIL PROTECTED] wrote: Corban, This may just be a typo in your email, but there was a space between the underscore and trackPageview. More to the point, did you try this syntax: ExternalInterface.call(pageTracker._trackPageview, page); See: Programming ActionScript 3.0 / Flash Player APIs / Using the external API / Using the ExternalInterface class -Jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter Sent: Wednesday, January 16, 2008 3:00 PM To: Flash Coders List Subject: [Flashcoders] Google Analytics ga.js Update Hey guys I was working on updating my script for the new Google Analytics ga.js code. Can some one tell me what I might be missing in my code? My actionscript: function tracking(page) { import flash.external.ExternalInterface; ExternalInterface.call(pageTracker._ trackPageview(' + page + ');); } tracking(/flash/home); Google's Javascript: script type=text/javascript var gaJsHost = ((https: == document.location.protocol) ? https://ssl.; : http://www.;); document.write(unescape(%3Cscript src=' + gaJsHost + google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E)); /script script type=text/javascript var pageTracker = _gat._getTracker(UA-2876431-9); pageTracker._initData(); pageTracker._trackPageview(); /script Thanks in advance! -- -cb http://blog.projectx4.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Corban Baxter http://www.projectx4.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] placing mc on the stage
You could also use random(500), but is deprecated - http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary630.html - how do i do to define the x and y position of each mc separately? I don't get it.. what do you want to do here? Leandro Ferreira On 1/16/08, Bob Leisle [EMAIL PROTECTED] wrote: Hi Pedro, Try this instead: Math.random()*500; Here's a simplistic but clear tutorial on the subject: http://animation.about.com/od/flashanimationtutorials/ss/mathrandom.htm hth, Bob Pedro Kostelec wrote: Hello i got this code: this.createEmptyMovieClip(canvas,this.getNextHighestDepth()); //creates an empty MC in which i attach 2 textMCs canvas._x = random500;//should place the MCs to a random position when they load but it doesn't work?!?-What is wrong here? canvas._y = random100; attachMovieInterval = setInterval(attachMovies, 200);//set interval for green mc reload function attachMovies() { for (var i = 0; i2; i++) { canvas.attachMovie(code,code+i,this.getNextHighestDepth()); canvas.code1._x = random500; canvas.code1._y = random100; canvas.code2._x = Stage.width/2; canvas.code2._x = Stage.height/2;//how do i do to define the x and y position of each mc separately? } } sorry for writing it so briefly. My keyboard doesn't work well and i cannot type a lot - -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Google Analytics ga.js Update
Right, but my suggestion doesn't change that. I'm just referring to the syntax of the code inside your tracking() method; I'm not suggesting that you do away with the method. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter Sent: Wednesday, January 16, 2008 3:45 PM To: Flash Coders List Subject: Re: [Flashcoders] Google Analytics ga.js Update I was trying to make it an easy call to the function from anywhere in the site. Thats why I created the function. I was hoping to just keep from having to write both lines all over the site. On Jan 16, 2008 2:17 PM, Jim Robson [EMAIL PROTECTED] wrote: Corban, This may just be a typo in your email, but there was a space between the underscore and trackPageview. More to the point, did you try this syntax: ExternalInterface.call(pageTracker._trackPageview, page); See: Programming ActionScript 3.0 / Flash Player APIs / Using the external API / Using the ExternalInterface class -Jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Corban Baxter Sent: Wednesday, January 16, 2008 3:00 PM To: Flash Coders List Subject: [Flashcoders] Google Analytics ga.js Update Hey guys I was working on updating my script for the new Google Analytics ga.js code. Can some one tell me what I might be missing in my code? My actionscript: function tracking(page) { import flash.external.ExternalInterface; ExternalInterface.call(pageTracker._ trackPageview(' + page + ');); } tracking(/flash/home); Google's Javascript: script type=text/javascript var gaJsHost = ((https: == document.location.protocol) ? https://ssl.; : http://www.;); document.write(unescape(%3Cscript src=' + gaJsHost + google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E)); /script script type=text/javascript var pageTracker = _gat._getTracker(UA-2876431-9); pageTracker._initData(); pageTracker._trackPageview(); /script Thanks in advance! -- -cb http://blog.projectx4.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Corban Baxter http://www.projectx4.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] placing mc on the stage
sorry. I forgot to copy this. random100=Math.random()/100; random500=Math.random()/500; - how do i do to define the x and y position of each mc separately? I don't get it.. what do you want to do here? what i want is to make one ofthose mcs moveup and downand the other right-left. Theproblem is tht i just can not do it function attachMovies() { for (var i = 0; i2; i++) {//iwantto place each of those mc-s into a different placeon the stage. I am not sure this is the right way. canvas.attachMovie (code,code+i,this.getNextHighestDepth()); //didn't it created on mc named code1 and another code2 canvas.code1._x = random500;//i triyed something like canvas.code1._x=500; instead of this but it didn't work. what i am doing wrong?? canvas.code1._y = random100; canvas.code2._x = Stage.width/2; canvas.code2._x = Stage.height /2; } }On 16/01/2008, Leandro Ferreira [EMAIL PROTECTED] wrote: You could also use random(500), but is deprecated - http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary630.html - how do i do to define the x and y position of each mc separately? I don't get it.. what do you want to do here? Leandro Ferreira On 1/16/08, Bob Leisle [EMAIL PROTECTED] wrote: Hi Pedro, Try this instead: Math.random()*500; Here's a simplistic but clear tutorial on the subject: http://animation.about.com/od/flashanimationtutorials/ss/mathrandom.htm hth, Bob Pedro Kostelec wrote: Hello i got this code: this.createEmptyMovieClip(canvas,this.getNextHighestDepth()); //creates an empty MC in which i attach 2 textMCs canvas._x = random500;//should place the MCs to a random position when they load but it doesn't work?!?-What is wrong here? canvas._y = random100; attachMovieInterval = setInterval(attachMovies, 200);//set interval for green mc reload function attachMovies() { for (var i = 0; i2; i++) { canvas.attachMovie(code,code+i,this.getNextHighestDepth()); canvas.code1._x = random500; canvas.code1._y = random100; canvas.code2._x = Stage.width/2; canvas.code2._x = Stage.height/2;//how do i do to define the x and y position of each mc separately? } } sorry for writing it so briefly. My keyboard doesn't work well and i cannot type a lot - -- Thanks, ~ Bob Leisle Headsprout Software Engineering http://www.headsprout.com Where kids learn to read! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Pedro D.K. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] placing mc on the stage
Thanks for the reply. but it still doesn't work for me. I can only see code1 moving randomly overthe stage, but thereis no sign of code2 movie clip. Here is a bigger peace of the code: this.createEmptyMovieClip(canvas,this.getNextHighestDepth());//creates an empty MC in which i attach 2 textMCs mouseInterval = setInterval(cahngeAlpha, 1);//set interval for bg and hello world reload attachMovieInterval = setInterval(attachMovies, 200);//set interval for green text mc reload function attachMovies() { for (var i = 0; i2; i++) { canvas.attachMovie(code,code+i,this.getNextHighestDepth()); canvas.code1._x = random500; canvas.code1._y = random100; canvas.code2._x = Stage.width/2; canvas.code2._y = Stage.height/2; } } function cahngeAlpha() { a._alpha = (Math.round(_root._xmouse/550*100)); a._xscale = (Math.round(_root._xmouse+250)-1)/0.9998; a._yscale = (Math.floor(_root._xmouse/550*20+100)); black._alpha = Math.round((550-(_root._xmouse))/550*100); white._alpha = Math.round(_root._xmouse/550*100); random500 = Math.random()*100; random100 = Math.random()*100; updateAfterEvent(); } attachMovies();//ou said ihave to put this. but for the other function(cahngeAlpha) i didnt and it works perfectly!! have i done a mistake? On 16/01/2008, Bob Leisle [EMAIL PROTECTED] wrote: Hi Pedro, A couple of things: Are you trying to place the MovieClips once in random places, or make them move to random places? Your code suggests one-time placement. What you say below suggests movement on the stage. Also, have you checked your random calculations? If you divide (/) Math.random, you will always get a number less than 1. Math.random() returns a number between 0 and 1 which can then be multiplied to get numbers usable for the stage coordinates. If you are trying to place the clips one time on attachment, here is a function, based on the code you sent, that works: random100=Math.random()*100; random500=Math.random()*500; // Assumes you've already created the MovieClip, canvas. function attachMovies() { for (var i = 0; i2; i++) { canvas.attachMovie(code,code+i,this.getNextHighestDepth()); } canvas.code1._x = random500; canvas.code1._y = random100; canvas.code2._x = Stage.width/2; canvas.code2._y = Stage.height /2; } attachMovies(); This will place code1 at the some random point between (0,0) and (500, 100), and place code2 at center stage, offset by it's own registration point hth, Bob. Pedro Kostelec wrote: sorry. I forgot to copy this. random100=Math.random()/100; random500=Math.random()/500; - how do i do to define the x and y position of each mc separately? I don't get it.. what do you want to do here? what i want is to make one ofthose mcs moveup and downand the other right-left. Theproblem is tht i just can not do it function attachMovies() { for (var i = 0; i2; i++) {//iwantto place each of those mc-s into a different placeon the stage. I am not sure this is the right way. canvas.attachMovie (code,code+i,this.getNextHighestDepth()); //didn't it created on mc named code1 and another code2 canvas.code1._x = random500;//i triyed something like canvas.code1._x=500; instead of this but it didn't work. what i am doing wrong?? canvas.code1._y = random100; canvas.code2._x = Stage.width/2; canvas.code2._x = Stage.height /2; } }On 16/01/2008, Leandro Ferreira [EMAIL PROTECTED] wrote: You could also use random(500), but is deprecated - http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary630.html - how do i do to define the x and y position of each mc separately? I don't get it.. what do you want to do here? Leandro Ferreira On 1/16/08, Bob Leisle [EMAIL PROTECTED] wrote: Hi Pedro, Try this instead: Math.random()*500; Here's a simplistic but clear tutorial on the subject: http://animation.about.com/od/flashanimationtutorials/ss/mathrandom.htm hth, Bob Pedro Kostelec wrote: Hello i got this code: this.createEmptyMovieClip(canvas,this.getNextHighestDepth()); //creates an empty MC in which i attach 2 textMCs canvas._x = random500;//should place the MCs to a random position when they load but it doesn't work?!?-What is wrong here? canvas._y = random100; attachMovieInterval = setInterval(attachMovies, 200);//set interval for green mc reload function attachMovies() { for (var i = 0; i2; i++) { canvas.attachMovie(code,code+i,this.getNextHighestDepth ()); canvas.code1._x = random500; canvas.code1._y = random100; canvas.code2._x = Stage.width/2; canvas.code2._x = Stage.height/2;//how do i do to define the x and y position of each mc separately? } } sorry for writing it so briefly. My keyboard doesn't work