ActionScript 3.0 :: Putting Code On The Movieclip Itself ?
May 30, 2010
I used to use flash is AS2. Now in AS3 I can't put any code on a movieclip.I used to for example put code on a movieclip so that onrollover it would simply play what was in it.How can I achieve this without putting code on the movieclip itself?
View 1 Replies
Similar Posts:
Aug 9, 2011
On the stage, I have a movie clip called mc which contains 20 frames.I have put mc.stop(); on frame1 of the main timeline, this puts a stop action in frame1 of mc.Now I want to put a stop(); action on frame10 of mc using the main time line where all my code is.
The code fl.getDocumentDOM().getTimeline().layers[0].frames[0].actionScript = 'stop();'; does seem to work and I don't know what to import.There also a code method addFrameScript(0, customFunction); but it only crashes flash player.
View 6 Replies
Oct 1, 2009
I see a lot of tutorials about coding actionscript 3 when they use all the code in a Class.I keep thinking every time why they use it in a class, instead of using actionscript on the stage.why it is more functional to code a class instead of putting code in the stage actionscript?
View 3 Replies
May 8, 2011
I have a situation where I am modifying a working FLA file to work in just one Scene of a project I am working on.The FLA file is linked to two external .as files.
I would like to take that code and call it from Fram 1 of the Scene as it will only but used for that scene and I do not want it affecting the other scenes.
I removed the package wrapper and changed any private function/public function just to function etc.part of the issue is calling on Movieclips in the library.I am trying to use drag and drop to drag Movieclips to Target transparent Movieclips.
The .as files uses:
import THE;
In a function I use:
the = new THE(); addChild(the); the._targetPiece = tTHE_mc; the.addEventListener(MouseEvent.MOUSE_UP, checkTarget); the.x = 103.50; the.y = 72.60;
I get an error for the "import THE;" as error 1046: Type was not found orwas not a compile-time constant: THE I get the error for the function reference as: error 1180 call to a possibly undefined method THE
View 11 Replies
May 3, 2011
Finishing off the code for my interactive top trumps game ... Basically I have a few layers for code as there's so much and one of the layers 'InGame Script' is code that I only want to run when the start button is pressed. Only problem is that by putting the code into an event listener it throws up all sorts of errors.
View 11 Replies
Oct 18, 2006
I need it to have a rollover in the initial state (which works fine) and then, in another state (represented by the onOff variable & mc),I need it to have a rollover that has a different size than the actual area being displayed (so that it will do the rollOut when the user leaves the area around the first line of text).I thought I had it figured out by putting a hitSpot movieClip inside the box movieClip, but the box rollover function doesn't let the hitArea rollover function through...Here's the code, and the fla is attached with some samples of what I'm trying to do.
Code:
var onOff:Number = 0;
onOff_mc.onPress = function() {[code]......
View 1 Replies
Aug 10, 2009
Assume the main time line is A. On A I've got movie clip Z also On A . I've got movie clip B and inside B I've got a movie clip C (I need it to be this way because it soft of a TAB meanu).My problem is the actionscript written in C makes few objects called planet 1, planet 2, planet 3 on A function well. But when I move planet 1, planet 2, planet 3 to a movie clip (planets_mc) it won't function! How can I put planet 1,2 and 3 in to one mc and still make the actionscript in C work?I've used the _root. command in the script C. Hope my question is clear enough!
View 3 Replies
Jan 8, 2010
I've been trying to embed an entire html page with all the graphics and text into a movieclip.I used a dynamic textfield within the movieclip and used the URLLoader to load html text into the textfield.Also i used the UIScrollBar.Everything works except that the images remain where they are while scrolling.I need the scrolling effect and so haven't used the wordwrap on the textfield.
Code:
import flash.net.URLLoader;
import fl.controls.UIScrollBar;
import flash.display.MovieClip;
import flash.events.Event;
[code]....
So I needed to know whether there is any other way of doing this so that i could get most of the layout settings of the html into movieclip so that i can just place the movieclip where ever i want that page to be displayed.
View 3 Replies
Nov 23, 2008
Anywho im trying to add thumnails to a gallery of mine. Everything works fine untill i put all the symbols in a movieclip. When i do that the scroller stops working but everything else works fine!
The tutorial im working from is: [URL]
And the part of code that is relevant is:
function thumbNailScroller() {
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 10;
[code]......
View 2 Replies
Jan 29, 2011
I am trying to create my first semi-serious flash game. The problem I am having is I want to be able to click a button in the players inventory to equip a different armor to the player, and have that armor work in the game on the same movieclip(Player) without having to re-make all the attacks and moves etc. for each change on another movieclip. My ideas are extremely novice like putting each armor and update on a different frame inside the Player movieclip and then doing a gotoAndStop to the frame. Though that may work I don't know how to goto a frame inside a movieclip. I would like to control this using as much code as possible.I would paste my code but I don't have any code for this part of the game so far. I have tried some simple coding but so far I cannot get the pieces together.
View 1 Replies
Nov 17, 2011
I'm working on an app for iOS where I want to load content dynamically from the library that contains text and graphics inside different MovieClip's.However, I have a problem, the code I have is for bitmap!How can I change it so it works for MovieClip instead?I want to use the MovieClip instead of bitmap?Also want to use the MovieClip class instead of Sprite class?[code]
View 5 Replies
Jun 23, 2009
I have been using TweenLite for all of my easing. I was wondering what the code is for having a button inside a movieclip not active while the movieclip is tweening.Then when the movieclip does finish tweening the button then becomes active.
View 2 Replies
Jun 18, 2010
Can a button play a movieclip if it lives within another movieclip? Let me explain: Buttons in a map key ran route animations on the map. Code for button (accessed by selecting button and F9) ..reads : on (release) { gotoAndPlay("BusRoute_375");}
[Code]...
All layers and consequently all route movieClips that relate to the map as well as the stop codes for the individual route animations now reside within that MovieClip which sits on a new layer above the map key layer. However, the key buttons no longer run the route animations. What should be done so that when clicked they still play the route MovieClips. Its like the button code cant see the layers it once refered to, now that they are in a movieclip.
View 5 Replies
Mar 31, 2011
I have a problem concerning sound. Sound and AS3 to be more specific.my shoddy description of the problem, but here it is: How do I stop() an AS3 INTERNAL sound from another movieclip?
This following Audio-code is on a movieclip within a (Base)movieclip. It stops playing/looping when a button is pressed that gotoAndStops on another frame within the same (Base)movieclip. But when a button is pressed outside the movieclip and (Base)movieclip, which gotoAndStops on another movieclip on the timeline, it continues playing.
[Code]...
View 3 Replies
May 11, 2004
putting a movieclip into highest depth without knowing which clip is in the highest depth
View 2 Replies
Nov 22, 2009
I can place the following code on a movieclip:
PHP Code:
onClipEvent(load) {
gravity = 0.2;
yspeed = 0;
[code]....
And it'll work fine, however if I place it like this on a frame in the movieclip:
PHP Code:
this.onLoad = function() {
gravity = 0.2;
yspeed = 0;
[code]....
It doesn't work
View 6 Replies
Sep 1, 2011
I want a movieclip to appear in a drag and drop game. When you successfully drag the right object and drop it then an animation is called from the library.The animation doesn't appear. However, when I use the same code at the beginning of my programme it does appear so it's not that part of the code that is the problem. Also, a trace statement does trace so it is running the code.[code]...
View 7 Replies
Sep 14, 2011
How can i get the hex color code of a movieclip?
View 8 Replies
Aug 30, 2010
url...Now click at "add image" and load any image.. The image will be shown on the shirt and the blue border shown around the image comes by-default or is it a movieclip? Secondly the image itself is a movieclip or external swf? And i know that movieclip has rotate and scaleX,Y properties that can work here but it seems that these properties are not used?? the script is rotating and stretching it due to container default properties.
View 1 Replies
Feb 22, 2010
I was wondering if there was any way to put code on an attached movieclip?
View 4 Replies
May 30, 2008
How can I desaturate a movieclip (to black&white) using AS3?
View 8 Replies
May 25, 2011
I've made a MovieClip of an electric wire with 3 different keyframes with a few frames between each. The first 2 keyframes have a single bitmap in each with a different picture, I want it to cycle between these two to make it look like the electricity is moving and not just sitting there. The 3rd keyframe has nothing, eventually I will put an image with the electricity off, so the player can walk through, I just haven't done it yet. Since I don't want it to run the last keyframe until the player turns it off, I put a gotoAndPlay(); command in the movie clip after the second frame looping it back to the first frame, problem is, the line refuses to work.
I have copied and pasted it from other programs where it worked, I have checked the Frame Name, I put other lines in there, like stop(); trace(); and other things, but could not get ANY line of code to work in the MovieClip. There's probably something like "the layer is invisible, code will not run", but I can't tell what it is. I've deleted the symbol and started over, same problem. I've restarted Flash, same problem. I've restarted the computer, same problem. I even took it to a different computer, same problem. I don't know why it won't run this code, is there something disabling it that I overlooked? I have other code in the main timeline outside the movie clip and code in other movieclips that has always worked fine and continues to work fine, I don't see what the problem is.
I ignored the problem for a while, and worked on other things, but I had to add multiple frames to an existing movieclip (which I believe was created before the other one), and now this movieclip is having the same problem. Does anyone know how to fix this, before it spreads to the rest?
View 1 Replies
Jan 20, 2009
When i put a movieclip on the stage, every time i do that, i have to click on it, press f9 (to show the movieclip actions pannel) and past a code on it... and i will use this movielcip a lot of times in my project, so, everytime i put it on the stage i have to put the code on it again... is there a way to attribute the same code to my movieclip (automatically) everytime i put my mc on the stage?
View 8 Replies
Jul 17, 2009
I'll try to make a movieclip for drag and drop event this is a code that I've find on the web:
Code:
package
{
import flash.display.Sprite;
[code]....
But this one make a vectoriale circle on the stage and makes it draggable.Now I've a movie_clip called "mc_Image" on my stage (that have inside a image background and some transparent button).
View 1 Replies
Jan 8, 2011
I have a MovieClip in the library of my project, it has this code in the first frame of its timeline:[code]Then in the first frame of my main timeline, I have this:[code]
View 6 Replies
Jul 13, 2011
I was wondering how to get my code to delete/remove the last movieclip'cause whenever I go to the gameOver frame the loop to remove all the movieclips leaves out one.
ActionScript Code:
function removeEnemies(spike) {
for (i=0; i<count; i++) {
_root["spike"+i].removeMovieClip();
}
}
View 1 Replies
Nov 17, 2011
I'm working on an app for iOS where I want to load content dynamically from the library that contains text and graphics inside different MovieClip's.
However, I have a problem, the code I have is for bitmap!
How can I change it so it works for MovieClip instead?
I want to use the MovieClip instead of bitmap?
Also want to use the MovieClip class instead of Sprite class?[code]...
View 5 Replies
Jan 17, 2011
-I need to load a movie clip to the stage from the library.
-I also need that movie clip to load with a certain string of actionscript code in it.
To load the movie clip, i checked the "export for actionscript" thing in the "linkage" section of the movie clip info, and i named the class "sol1".I then used this code on the first (and only) frame:
Code: Select all
_root.attachMovie("sol1", "NewInstanceName", {_x: 50, _y: 100});
It seems to work, but the question is, how do i load the movie clip with code in it?
View 3 Replies
Dec 22, 2004
So I have a quick movie clip and when that clip finished I want to do the following:
Code:
_root.logo_top.attachMovie("sabotage_media_logo", "sabotage_media_logo_mc", _root.logo_top.getNextHighestDepth());
_root.logo_top.sabotage_media_logo_mc._x = 50;
_root.logo_top.sabotage_media_logo_mc._y = 50;
What do I need to do? I tried doing onClipEvent(load) but it loads it at the start of the clip.
View 3 Replies
Mar 26, 2009
I am trying to set up a code that will make a MovieClip visible = false when you press the spacebar then reapear when you hit the spacebar again. I had it working once but I lost the code somehow ... think I deleted the wrong file. the one time I got it to work I used a keylistener and stuck the code in the action panel on the timeline at frame 1.
I thought maybe there is a way to do the same thing but instead of the frame 1 action panel thing. I thought you might be able to set it up in a movieclip class action script file. I did these tutorials on the kongregate site ... shootorials and they teach you how to make a MC move with the arrow keys which was easy ... they had you make a ship into a movie clip then you created a new AS class file for the ship movie clip. Then they placed the code under the function onEnterFrame() in the ship class AS file which works well when you want to move something ... because it checks every frame.
I can set up what I want in that area just fine ... problem is it fires off every frame .. so my movie clip blinks on and off several times everytime I hit the spacebar. I just want it to disapear when you hit the spacebar then become visible again when you hit the spacebar again.
Seems like this should be a very easy thing to do but I spent all day reading through tutorials and searching google everything I tried all I did was run into one error or another when I tried to compile for a test.
I am very new to all this so the other thing that confuses me is the fact that you can put code in so many different places and depending on where it goes the same thing might be written a different way depending on where you write it.
View 2 Replies