I try to use onPress function inside an onLoadInit function but nothing will be traced. I can see my hand cursor over my icons though. I also tried with onLoadComplete, but no change...
How do I get the for-loop's i variable to be available inside the onLoadInit function????
Code: for (var i = 0; i<nTotalPics; i++) { main.createEmptyMovieClip("container"+i,i); var container:MovieClip = main["container"+i];[code]....
This has been bugging me for about 2 months now. Maybe I'm looking at it the wrong way, but I need to create more things in the onLoadInit function using a for-loop.
package { import flash.display.MovieClip; import flash.display.Graphics; public class Rail extends MovieClip
[code]...
this is a simple Rail class, what I am trying to do is take the for loop out of the timeline and build into the Rail class itself. How do I refer to the Rail class itself within the method? If I am doing this the wrong way please let me know! Would it be better if I created another class, say a "RailSpacing" class and build the for loop into the contructor into that?
Also, if I wanted to add depth to the rail(textures or something else to make it look real) and still be able to change the color without transforming the entire rail instance, what could I do ActionScript wise. I have come to the conclusion the only way to do this is creating a multilayered movieclip and target the base object and not the highlight/ shading layer.
Also, if I created a nice graphic/movieclip and exported it for ActioSncript, how can I find the class file and add too it? Is this even possible? Is it possible to draw something that is detailed and export it and then add some methods?
I have a flash code where i am loading an AS 2 SWF inside AS 3. The thing is if i put the AS 2 SWF on same domain its working fine but if i put AS 2 SWF on different domain it loads the SWF properly but the "stop()" written inside the AS 2 frame doesnt work... and it keeps on playing all the frames continuously...
I am loading a few thumbnails from XML.When they load in, I want them to perform a few simple functions.However, when I load them in, Only the LAST thumbnail takes the onLoadInit() function.
Code: function AttachThumbs(xmlData) { xmlNode = xmlData.firstChild.childNodes; var total:Number = xmlNode.length;
[code]....
It's as if I need to create multiple loadListener objects.. one for each thumbnail, but I dont know how to do that when declaring a variable .. ie: one cant say:
I need to get the width and height of the image before it finishes loading with a moviecliploader instance. This is for placement of another clip, which will always load before the image. Is there any way of doing this??? onLoadStart does not give dimensions of the image.
how do I access a button within the emptymcholder, and place it at a specific position?? Is this possible??
I tried doing emptymcholder.buttonname._x, but it does not work.
I am using a moviecliploader object to load a clip into the timeline. I have a loader movieclip for the graphic placed on the stage. The idea is to gotoAndplay a certain frame as per the percent loaded so far.But the percent value is always 100. Is this because I am testing it on my local machine? But even so, shouldn't every trace fire, as percent value will fall in these categories sometime. The code within onloadInit is:
I am working on a full screen background with multiple images fading into each other. I already have something working with images that are loaded from inside the library. you can see it here: linkNow I am working on a script to dynamically load the images via FlashVars.I have the folowing function, witch gets called the moment I want to load the second image and replace it with the first. The idea is to start the putImage function the moment the image is loaded, but i cant get the loader.onLoadInit to triger.
ActionScript Code: // load second image switchImage = function() {
The onLoadInit is broadcasted before the target is indeed initialized.Searching about this, I founded at the macromedia documentation that other developers are having the same problem,
I'm using cacheAsBitmap to create a gradient mask. The code I set up worked great and all was well but I soon discovered problems when cacheAsBitmap was being nullified when its parent mc was loaded into another mc. I read up on it and from what I understand, since I'm using the MovieClipLoader class, this code should be included in onLoadInit in the root mc (start_mc). Basically this is what I have: start_mc loads main_mc (target) and rollMask1 and roll1 are contained within main_mc. Here's the script for onLoadInit:
I have a function that I use to load images. I center align the images after loading by using loadClip() and attaching the function that centering to the onLoadInit event. The problem I'm having is that the centering stop working when I upload the flash movie to a webserver. I was also able to replicate this when I Test the movie and then go to View->Simulate Download.
Here is the function in question: Code: Select allfunction displayImage( img ) { // trace('displayImage()'); // lets mave the container invisible before loading the clip _root.mcLargePhoto.centerPhoto._alpha = 0; _root.mcLargePhoto.createEmptyMovieClip("centerPhoto",this.getNextHighestDepth()); var mclListener:Object = new Object(); mclListener.onLoadInit = function(target_mc:MovieClip) { // trace('onLoadInit()'); [Code] .....
Generally, I like to use onLoadInit because it gives me accurate widths and heights. But when I have an external SWF file with a video embedded in it, I find that onLoadInit always fires a second or two after the video has started playing.
I have a problem with some code. Its in the else statement below. Essentially I am trying to make sure I can read in the mc._height value before I continue with the code, I use a listener to check that I can get the value which I can,however it seems to do all the code after the loadListner.onLoadInit function before this function.
In a setup like this is it possible to check the cumulative status of all onLoadInit?
for(var i:Number = 0; i < limit; i++) { var mcLoader:MovieClipLoader = new MovieClipLoader(); var mclListener:Object = new Object(); mclListener.onLoadInit = function(mc:MovieClip) {
[Code]....
Initially I was thinking that I could pass an array of Boolean's, but I'm not really sure where to add that checkpoint, because a flash frame doesn't keep looping. Would I have to add it to an onEnterFrame()?
I'm sitting here doing some C# programing and in one of my switch statements I ended up using the goto keyword. Well just out of curiosity I booted up FDT and created another switch statement in ActionScript 3. Well to my surprise there is apparently no goto keyword in AS3 or at least I couldn't find a substitution.
I am using movieClipLoader to load external swfs via xml. I am trying to set it up to automatically play the next movie after the current swf is done. The problem is, after the current swf is done playing, the actionscript tries to load all the rest of the swfs in the xml file and not just the next one. So it ends up playing the last swf in the xml file. I added "delete this.onEnterFrame" but still not working.. see code below
I'm trying to create a movie, that when a correct word is entered, it goes to a specified frame. The code below words fine but I need to make an addition to it,
on (release, keyPress "<Enter>") { if (inputtext eq "word1") { gotoAndStop("frame1"); } else if (inputtext eq "word2") {gotoAndStop("frame2");[code]....
I was hoping to add extra words that would go to the same frame. I know I ca do this by�
if (inputtext eq "word1") { gotoAndStop("frame1"); } else if (inputtext eq "word3") {gotoAndStop("frame1");
but was wondering if there is an easier way, something along the lines of�
if (inputtext eq "word1", "word2", "word3") { gotoAndStop("frame1");
I was wondering if there is an easy way to search a string for a keyword. I am working on a twitter piece which searches strings for keywords and have found a way of loading all the data properly.
I'm a complete novice to ActionScript, OOP and Flash. I have no idea when you are supposed to use the keyword "this". I have searched the forums but obviously searching for the word "this" is not very successful! I've read quite a few tutorials now and it seems that different people have different opinions on when and where it should be used. For example what should I be doing in the following class? Both seem to work but is one the "correct" way? Are there situations where things will not work if you omit the "this"?
ActionScript Code: public class Sector { private var _radius:Number; public function Sector(radius:Number){ [B]this.[/B]_radius = radius; } public function get radius():Number{ return this._radius; } public function set radius(value:Number):void{ this._radius = value; }}
I have another possibly related question with regards to naming conventions. I like the use of underscores for properties with getters and setters but what about the names of the constructor parameters that are used to initialise these properties? In the above example I have used "radius" for the constructor parameter although it is also used for the getter and setter functions. It seems a bit of a palaver to come up with different names for the same quantity but is what I have done really bad coding practice?
I am trying to create a number of movie clips in my main movie but I don't seem to be able to access these movies using array notation and the 'this' keyword. Here's some example code in a main timeline. var i=0; createEmptyMovieClip("clip"+1,0); trace(this["clip"+i]); ////undefined - why????? var clip=createEmptyMovieClip("clip_holder",1); clip.createEmptyMovieClip("clip"+i,0); trace(clip_holder["clip"+i]); /////_level0.clip_holder.clip0. This is ok. What's wrong with this["clip"+i] ?
i got an error in AS.1042: The this keyword can not be used in static methods. It can only be used in instance methods, function closures, and global code.this is the error line.public static var defaultEase:Function = this.easeOut;