GoToAndPlay Action Doesn't Work From Inside A Movieclip?
I have a button that is 2 levels under the main timeline inside of a movieclip and it will not accept a simple "onrelease gotoandplay" action. do i need to add something in the code to tell it to play on the root timeline?
Right now it just says:
on (release) {
gotoAndPlay("testimonials", 11);
}
and it's two levels under the root timeline.
FlashKit > Flash Help > Flash ActionScript
Posted on: 06-08-2007, 10:15 PM
View Complete Forum Thread with Replies
Sponsored Links:
SetProperty Doesn't Work With Movieclip Inside Of Movieclip
I originally had this set up this way and it worked.
var hita:Boolean = false;
logotop.onEnterFrame = function() {
hita = this.hitTest(this._parent.middle.hitme);
if (hita == true) {
setProperty ("logotop", _alpha, "0");
}
}
Then I put everything in a new movieclip with the instance name "printme".
Now it doesn't work and doesn't give me an error.
var hita:Boolean = false;
printme.logotop.onEnterFrame = function() {
hita = this.hitTest(this._parent.printme.middle.hitme);
if (hita == true) {
setProperty ("printme.logotop", _alpha, "0");
}
}
Do you see anything wrong with the above code?
View Replies !
View Related
Scrollpane Doesn't Work Inside A Movieclip
I don't know if I am correct or not, but I have tried everything to make a scrollpane work inside another movieclip, but yet unsuccessful. But when it is on the main stage it works great!
Any ideas why this is?? Am I doing something wrong? Has anyone been successful with this?
Thanks,
Eric Ehle
View Replies !
View Related
Button Inside Movieclip Doesn't Work
Hello, I am quite new with flash and actionscript and I have a problem making a button symbol work in one of my movieclips.
This is what i have so far: click here
On the first frame, i have:
quote:stop();
menustrip_mc.onRollOver = function (){
gotoAndPlay("over");
}
"menustrip_mc" is a movieclip with only one frame. It contains the whole orange strip and the red square. The square is a simple button symbol.
So when i go over "basic" (picture one), the strip slides out with a simple motion tween. (picture two).
On frame 30 (end of motion tween), i wrote this code:
quote:stop();
menustrip_mc.onRollOut = function (){
gotoAndPlay("out");
}
When I roll out, the strip goes back in and the animation stops on frame 1 again.
All this works well except the button doesn't work, if i go over it during the motion tween, i can see the over state of the button but when the motion tween ends, it goes back to up state and doesn't do anything.
I tried many ways and nothing works (this one works best). Does anyone have an idea how to solve the problem?
View Replies !
View Related
Button Inside Movieclip Doesn't Work
Hi guys
Sorry for what is probably a stupid question.
I'm building a navigation menu.
In the first frame of the main time line i have 7 movieclips which are buttons. Within these movieclips there are additional buttons with a simple rollover function to change the background colour.
The problem I'm having is that the action on the buttons doesn't work. I'm guessing this is something to do with the AS i have within the mc.
I've had a good look through the forums and on Google but have yet to find the answer. So I'm hoping someone here can help or point me in the right direction.
I've attached the fla.
Thanks for reading
Russ
View Replies !
View Related
Button Inside Symbol(movieclip) Doesn't Work. Plz Help. Thanks
I created a drop down menu which contains 3 buttons(home, contact, game). I had tried to put onRelease on its button itself, it couldnt work. Same as another method which the script on the layer actions. Can anyone please tell what is wrong with my flash? I'm still begginer in flash and i'm really clueless now. I had attached my file into this thread. Please have a look. Thousand thanks
View Replies !
View Related
Rollover Buttons Inside Movieclip Doesn't Work
Hi guys
sorry i have this stupid beginner problem here
and I have tried to search related issues but I still can't figure the way to make my buttons work
http://www.angiehu.com/upload/showroom/test2.fla
here is my fla file...
Basically I have a rollover buttons inside a movieclip and my action script in the first frame of the scene is the following
_root.designer_mc.b1_01.onPress=function(){
goto("designer01");
}
b1_01 is the instance of the button inside designer_mc movieclip~ however I realized that buttons won't work in movieclip
and i just don't know what's other solution
I will be really appreciated if anyone can teach me how to get this fixed~ i m so stuck and I have wasted my past 2 days trying to figure this out and still no result...
I have learned flash at least 5 years ago and now I found out that actionscript works a lot different than before and I can't make things work (damn it)
View Replies !
View Related
In My Movieclip GotoAndPlay("scene",1) Doesn't Work
i'm using Flash MX
first i made movieclip, then inside movieclip, made button.
so in the mymovieclip,there is mybutton.
after that, In Maintime, i used follwing code and it works,
mymovieclip.mybutton.onRelease = function(){
gotoAndPlay("mainscene",1);
trace("can you see me");
};
my question is,
i wanna code inside mymovieclip,since this movieclip used many time, and i don't want to type
for every mymovieclip instance.
here is following code, inside mymovieclip, and it doesn't work!
this.mybutton.onRelease = function(){
gotoAndPlay("mainscene",1);
trace("can you see me");
};
i got only "can you see me" message,
gotoAndPlay("mainscene",1); command doesn't work.
i already tested _global.gotoAndPlay("mainscene",1);
i have two scenes in this scenario.
what's wrong? am i fool?
View Replies !
View Related
Button Inside Movie Clip Inside Scrollpane Doesn't Work In Xml
This is sorta odd but I'm hoping somewhat easy to fix. This is in AS2 and is the last problem I have in a very small project of mine.
I have button called button01 inside a movieclip called movieclip01 which is the contentPath for a scrollpane called scrollpane01. I'd like the button to work, and depending on the code it will work in the normal .swf but won't when I embed my movie into xml.
If I put the code inside movieclip01
button01.onRelease=function(){
_root.gotoAndPlay("Frame Name");
}
It will work when I test it but not in the XML. So what I want to do is go to the main timeline where the scrollpane is and write the code there. That is where I'm stuck.
I've tried scrollpane01.movieclip01.button01 and tried movieclip01.button01 and also tried scrollpane01.button01. Just for giggles I also tried scrollpane01.movieclip01 but none of that works
Last night I had a similar problem with buttons inside a movieclip that was on the root stage. They worked in the swf but not when I embedded the file - so I found this which worked (typed in the root stage)
movieclip01.button01.onRelease=function(){
View Replies !
View Related
Gotoandplay Doesn't Work
hi, can anyone give me any advice, i'm using flash mx...
i have a button in a movie, the movie is in the scene 'home'.
the button actions are as follows:
on (rollOver) {
gotoAndPlay(1);
}
on (rollOut) {
gotoAndPlay(8);
}
on (release) {
gotoAndPlay("home", 2);
}
but when i press the button it doesn't go to and play in the scene 'home' but goes to and plays frame 2 in the movie. please help, thanx for ur time.
View Replies !
View Related
GotoAndPlay Doesn't Work
Hi everyone,
I an experienced object-oriented developer getting my feet wet in flash and trying to put together a SF2-style fighting game. I have a movie that contains a Game movie clip/class which contains two Player movie clips/classes, each of which contains a static movie clip with a linkage name of "Frame." The "Frame" clip is empty and it's just used as a placeholder to load an external ".swf" file that contains the animations for the various actions the player can execute. This is done by executing
_someplayer.Frame.loadMovie("blahblah.swf");
everything works properly when the program starts. I attach an instance of the game class using attachMovie, the game constructor fires which attaches two instances of the player class to itself using attachMovie.
I use a custom loader movie(not the component provided in MX) which calls the Game's "Reset" method once it determines that all objects have loaded. This appears to work fine.
The game's "Reset" method calls the players "Reset" method. All this does is set some properties to initial values AND attempts to play the ".swf" loaded into the "Frame" object using gotoAndPlay. This is where the problem arises: it doesn't respond to gotoAndPlay command. I've tried using labels, and I've tried using frame numbers. No matter what it just plays the movie start to finish.
I heard that there could be problems with interacting with movie clips that you have dynamically created or loaded until you reach the second frame. However I also heard that movie clips that are dynamically created or loaded in 1 keyframe disappear as soon as a new keyframe is encountered.
Here is the relevant portion of the code:
Code:
Game.prototype.Reset = function (){
this._player0.Reset();
this._player1.Reset();
this._player0._x = Game.Player0StartingXPosition;
this._player1._x = Game.Player1StartingXPosition;
this._player0._y = PhysicsObject.FloorY;
this._player1._y = PhysicsObject.FloorY;
this._timeElapsed = getTimer();
this.onEnterFrame = Tick;
}
Game.prototype.Tick = function(){
// game loop
}
Player.prototype.Reset = function(){
trace("Player " + this._direction+" Reset");
this._canExecuteMove = true;
this._isAirborne = false;
this._isCrouching = false;
this._canReverse = true;
this._direction = direction;
this._canReverse = true;
this._isBlocking = false;
this._isLowBlocking = false;
this._isFalling = false;
this._startingAccelerationX = 3;
this._startingAccelerationY = 5;
this.Frame._scaleX = this._direction * 100;
// This command appears to do nothing.
this.Frame.gotoAndPlay("Initialization");
}
View Replies !
View Related
GoToAndPlay? But Doesn't Work
Hi -- thanks for reading this. I want to do something simple but can't recall how to do it.
I want to influence a MC from a frame. The MC is already on stage. I
just want that have that movie clip play at designated label instead
of the beginning where it normally does when we reach a given frame.
I'm moving the MC around manually so I wouldn't do attachMC or
anything like that.
I'm not clear on how I do that anymore. Do I need any kind of code in
my frame besides ...
_root.myMCname.gotoAndPlay("label")
(with myMCname reflecting the on-stage Properties label, not the "real" MC name)
because that's not working.
Thanks for any guidance you can give. I hate to get tripped over
something this basic.
View Replies !
View Related
GoToAndPlay Doesn't Work
I am using the dissolve function and when the dissolve function is complete it is suppose to go to the next frame on the root timeline and play. It isn't working when I use a frame label (_root.guyField_mc.gotoAndPlay("u30");) it goes to the labeled frame then stops. When I use nextFrame (_root.guyField_mc.nextFrame("u30");) it jumps to the last frame, not the next frame, on the root timeline. I can't figure out why it isn't working. Everyplace I look states the code the way I wrote it should work. I have attached the code. I have tried both the bottom two lines and neither one work. I would greatly appreciate any help with this.
Thanks
C
View Replies !
View Related
GotoAndPlay() Doesn't Work
Hi all,
I have developed a flash that loads some JPEGs from an URL into movieclips and move them thru the screen. The loading part is done in the 1st frame, and in the second frame starts the movement. For avoiding to load again the images, in the last frame I've set an gotoAndPlay(2), but the problem is that that from the second loop, no image is displayed. Here is the code I'm using for loading the images:
_global.path1="";
_global.path2="";
loadVariablesNum("http://localhost/images.txt", 0);
this.onData = function() {
loadMovie(path1, "MC_image1");
loadMovie(path2, "MC_image2");
gotoAndPlay(2);
}
Thanks in advanced
Alberto
View Replies !
View Related
GotoAndPlay In A Button In A MC Doesn't Work
I have a simple MC on the scene which contains only a button, this button has the following code :
on (press) {
gotoAndStop("_root","page2");
}
I have included the button in a MC because i need to hide it sometimes.
When i click on the MC, the gotoAndStop doesn't work, when i put the button directly on the scene it works.
though, the label "page2" exists.
thanks for your help.
View Replies !
View Related
Simple GotoandPlay Doesn't Work
I'm not a total noob, been doing Flash stuff for a few years, and I'm trying to do something very simple. I have my "Main" scene with my navigation menu on frame 5. At frame 185, I have a stop action, and an MC runs, and at the end of the MC, I have the action
[ gotoAndStop("Main", 5); ] in order to return users to my original menu in the original scene. This does not work, however. It won't leave the movie clip; I switched it to gotoAndPlay instead of Stop and it just runs the MC over and over, indicating that it's not returning to the Main scene.
Why does this command have the option to choose the scene if it doesn't work? I presume I'm doing something wrong here, because that just wouldn't make sense.
Thanks!
View Replies !
View Related
GotoAndPlay(frameLabel) Doesn't Work. Please Help
Dear all,
I am encountering the following problem, please help. I am using Flash 8 Professioanl.
I write the following code in frame 1 for a layer in a scene.
li_framePos = 17 ;
ls_frameName = “sectionA” ;
If I write
gotoAndPlay(li_frmaePos);
then it works correctly – go to frame 17
If I write
gotoAndPlay(ls_frameName);
then it doesn’t work, it doesn’t go to the frame named sectionA
I also try
gotoAndPlay("sectionA");
it works again.
Any idea about the problem. I really need to do the logic like gotoAndPlay(string variables) because I need to do dynamical goto certain frame.
Thanks a lot.
View Replies !
View Related
_root.gotoAndPlay(varName) Doesn't Work
Right now, I'm developing a flash game, and I have pop-up text boxes. There is a continue button on these boxes. Clicking the continue button makes the box dissapear, and on the last frame of the animation, I originally had this code -
Code:
_root.gotoAndStop(varNum);
removeMovieClip(this);
This gave me problems. varNames value was two, and when it sent me to scene two (my game is split into 3 scenes, Menu, Options, and Game) I assumed that the flash worked that way. THen I changed it.
Code:
_root.gotoAndStop("Game", varNum);
removeMovieClip(this);
However, this gave me the same problem. THen I tried...
Code:
tellTarget(_root) {
gotoAndStop("Game", varNum);
}
removeMovieClip(this);
and THAT wouldn't work. THen I dug down into all possible ways of doing this and tried this...
Code:
with(_root) {
gotoAndStop("Game", varNum);
}
removeMovieClip(this);
And, to my disbelief, it didn't work. Suggestions would be nice
View Replies !
View Related
[CS3]gotoAndPlay() Doesn't Work After Movie Finishes
I am making a flash website. The whole thing is about 25 frames long. At frame 5 I have a movie clip that plays and stops everything (using stop(). When the movie clip is finished I want it to continue playing the rest of the frames but it doesn't want to work.
What I am wanting is the layout to get to frame 5, then stop and wait until the movie clip is done. Once it's done, finish the rest of the frames.
On the movie script layer at frame 5 I have the following code
Code:
if (Marine1.state=="playing"){
stop();
trace("Playing");
}
if (Marine1.state=="stopped"){
gotoAndPlay(6);
trace("Stopped");
}
It appears that at the very beginning of frame 5 the video is stopped and it is playing. I get both "playing" and "stopped' as output on frame 5. The whole thing doesn't stop at frame 5 either, it just goes on like normal.
Can anyone help me?
View Replies !
View Related
GotoAndPlay() Doesn't Work From Upper Level?
Hi,
This is some really weird problem... It's been an hour I am trying to figure it out, but I don't know why, it feels like it's something really stupid that I can't find.
It's a simple gotoAndPlay :
ActionScript Code:
_root.mainContentMC.portfolio.gotoAndPlay(2);
This works ONLY if I place the code in _root.mainContentMC.portfolio or a deeper level. It doesn't work on _root, _root.mainContentMC or any other.
What happens is it does go to the frame, but doesn't play from there... As if it did a gotoAndStop();
- Tried naming the frame and addressing the frame's name, doesn't work.
- Tried absolute and relative addressing, doesn't work.
- Tried changing the MC's instance name, doesn't work.
- Tried sending other instructions (gotoAndStop, _alpha...), IT WORKS...
I really have no idea on what's causing this...
Thanks for any help,
Simo
--------------
EDIT :
Actually, I made some tests, and the gotoAndPlay works if I attach the code to a button, but not if I attach it to a frame.
I attached here a stripped version of the FLA where I removed everything but the main parts.
On frame1 of _root, I placed :
ActionScript Code:
_root.mainContentMC.portfolio.gotoAndPlay(2);
And on the button on the _root level, I placed :
ActionScript Code:
on(release)
{
_root.mainContentMC.portfolio.gotoAndPlay(2);
}
The code on the button does go and play, but the code on the frame does just a gotoAndStop(2)
???
Any idea?
View Replies !
View Related
Newbie AS3: GotoAndPlay Doesn't Work Properly
hi.
I want to make my flash start at either frame 11, 61, 111, 161, 211, 261 or 301.
so I've tried setting up my Flash like this:
Code:
stop();
var minListe:Array = [12,61,111,161,211,261,301];
var minStart:Number = Math.random()*7;
minStart = Math.floor(minStart);
trace("minStart= "+minStart);
gotoAndPlay(Number(minListe[minStart]));
trace("minListe[minStart] = "+minListe[minStart]);
but when testing my Flash jumps to frame 2 and plays.
so I've tried this instead:
Code:
stop();
var minStart:Number = Math.random()*7;
minStart = Math.floor(minStart);
trace("minStart= "+minStart);
if(minStart == 0){
gotoAndStop(12);
trace("12");
} else if (minStart == 1){
gotoAndPlay(61);
trace("61");
} else if (minStart == 2){
gotoAndPlay(111);
trace("111");
} else if (minStart == 3){
gotoAndPlay(161);
trace("161");
} else if (minStart == 4){
gotoAndPlay(211);
trace("211");
} else if (minStart == 5){
gotoAndPlay(261);
trace("261");
} else {
gotoAndPlay(301);
trace("301");
}
still same problem. it jumps to frame 2.
actually I thought this newbie-stuff would never bother me again, but I really don't get this problem.
can anyone tell me what I'm doing wrong?
thanks
View Replies !
View Related
Gotoandplay Won't Work Inside MC
I have a movieClip inside a movieClip.
MC1: on the main timeline
MC2: inside MC1
I have some actionscript inside MC1 that tells MC2 to gotoandplay frame 2, but it won't play, it just goes to frame 2 and STOPS!
I'm sure there's an easy explanation for this, but I can't find it. I searched the BB, but none of the posts I found seemed to discuss it. I probably am not searching with the right keywords though.
Can any of you give me a hand here?
View Replies !
View Related
GoToAndPlay Random Frame Doesn't Work In Browser
I have a movie and I would like it to start at a random frame... it works great when i preview it, but it doesn't work when I publish it to my browser. Any help would be greatly appreciated.
Code:
_root.onLoad=function() {
var random_frame:Number = random(6)+1;
switch( random_frame ) {
case 1:
gotoAndPlay(2);
break;
case 2:
gotoAndPlay(100);
break;
case 3:
gotoAndPlay(150);
break;
case 4:
gotoAndPlay(200);
break;
case 5:
gotoAndPlay(250);
break;
case 6:
gotoAndPlay(300);
break;
case 7:
gotoAndPlay(350);
break;
}
}
Any suggestions?
View Replies !
View Related
Movie Clip Button GotoAndPlay Doesn't Work
Hi there,
Been struggling with something easy, trying to make a button using a MC. It's a simple square that goes to full alpha when rolled over, and should navigate to another scene when pressed. The rollover part works fine, but the switch to the scene does not.
The main issue is the onRelease - "ratingsStart" is the frame label name of the first frame in my new scene. When I press the button, it is getting the event - I can see a test message sent via Trace(). But for some reason, it does not load the new scene. I tried the scene name as well, that does not work. I do have a stop(); in frame one of the new scene so it should go there and stop.
Is there a better way or have I made a mistake in my code?
Attach Code
stop();
this.onEnterFrame = function(){
if(rewind == true){ //if rewind switch is set to true play backwards
prevFrame(); // play backwards
}
}
this.onRollOver = function(){
rewind = false;
play(); // play this movie clip
}
this.onRollOut = function(){
rewind = true; //set or rewind switch to true so it will play backwards...
}
this.onRelease = function(){
gotoAndStop("ratingsStart", 1); // name of label in my second scene
}
View Replies !
View Related
GotoAndPlay Inside A Movieclip
hmm.. I'm having a problem.. I'm making a game.. In the game there is a scene (called scene 1) in that scene there is a movieclip.. Inside that movieclip there is alot of frames, and on the last frame there shall be a gotoAndPlay script that makes you go to scene 2 that is outside the movieclip... I have tried with gotoAndPlay("Scene 2", 1); and stuff, but it doesn't work
Can anybody help me ?
View Replies !
View Related
GotoAndPlay Inside A Movieclip
hmm.. I'm having a problem.. I'm making a game.. In the game there is a scene (called scene 1) in that scene there is a movieclip.. Inside that movieclip there is alot of frames, and on the last frame there shall be a gotoAndPlay script that makes you go to scene 2 that is outside the movieclip... I have tried with gotoAndPlay("Scene 2", 1); and stuff, but it doesn't work
Can anybody help me ?
View Replies !
View Related
OnRollOver() Inside MoveClip Inside MovieClip Doesnt Work
could someone help with this. i dont know why the onRollOver function doesnt work for my submenu button. trace("over main btn") for mainmenu button works fine but trace("over submenu btn"); doesnt work :/
ActionScript Code:
CreateMainMenu = function (x, y, depth, node_xml) {
var cNode;
var cItem;
var cMenu = this.createEmptyMovieClip("mainMenu", 0);
for (var i = 0; i<node_xml.childNodes.length; i++) {
cNode = node_xml.childNodes[i];
cItem = cMenu.attachMovie("mainMenuBtn", "mc"+i, i);
cItem._x = menu_x+i*(cItem._width+5);
cItem._y = menu_y;
cItem.menuname = cNode.attributes.name;
cItem.node_xml = cNode;
if (cNode.nodeName != "menu") {
cItem.arrow._visible = false;
}
cItem.onRollOver = function() {
this.gotoAndStop(2);
h = 0;
clearInterval(newInt);
trace("over main btn");
subMen = this.createEmptyMovieClip("subMenu",200);
newInt = setInterval(openSubMenu, 50, this._x,this._y,subMen,this.node_xml);
}
cItem.onRollOut = function() {
this.gotoAndStop(1);
this.subMenu.removeMovieClip();
};
}
};
openSubMenu = function (x,y,clip,node) {
if(h<node.childNodes.length) {
subM = clip.attachMovie("subMenuBtn","subBtn"+h,300+h);
subM.menuname = node.childNodes[h];
subM._visible = true;
subM._y = subM._height*(h+1);
subM.onRollOver = function() {
trace("over submenu btn"); //<------------- it doesnt work :(
}
h++;
} else { clearInterval(newInt); }
};
var menu_x = alertArea._x;
var menu_y = alertArea._y;
menu_xml = new XML();
menu_xml.ignoreWhite = true;
menu_xml.onLoad = function(succeed) {
if (succeed) {
alertArea._visible = false;
CreateMainMenu(menu_x, menu_y, 0, this.firstChild);
} else {
alertArea.alert = "error: XML not successfully loaded";
}
};
menu_xml.load("menu.xml");
sample xml file for this menu:
ActionScript Code:
<?xml version="1.0"?>
<menu name="XML Menu">
<menu name="firm">
<item name="about" link="http://#"/>
<item name="portfolio" link="http://#"/>
<item name="contact" link="http://#"/>
</menu>
</menu>
does anybody know what is the problem ?
View Replies !
View Related
[F8] Movieclip Inside Movieclip GotoAndPlay
i have a movieclip button inside a movie clip that say the movieclip button "btn1960_mc" is the button i'm trying to click to go to the other scene.
problem is. when i clik this nothing happens at all.
btn1960_mc.onRelease = function() {
_root.gotoAndStop("Scene2",1);
}
i attached the thing i'm working on.
View Replies !
View Related
Button Inside Mc Doesn't Work
Ok, so here's a question:
I have a button "b1" which set "mymc" to visible by ac
mymc._visible = true;
inside "mymc" is a another button "b2" which comes visible with same ac ('cos it's build in to "mymc"). Mouse cursor changes as showing it is a button (turn into a pointing finger), however nothing happens if I click that "b2".
Is this a bug or is it just that there can't be a button inside mc.
(Or is it just user error that I can't see
View Replies !
View Related
HitTest On Mc Doesn't Work Inside Other Mc
Hi!
I have used this hitTest before to run a movie clip on mouseover - now I need to use it inside another movie clip. It works on the main timeline, so what do I need to change to get it to work inside the other movie clip?
Code:
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
if (this._currentframe<this._totalframes) {
nextFrame();
}
} else {
if (this._currentframe>1) {
prevFrame();
}
}
}
Hope someone can help me! Thank you in advance.
View Replies !
View Related
AS On Buttons Doesn't Work Inside MC's?
I need some help, I'm sure this is fairly simple, I just can't figure it out.
I found the tutorial on "loading into target for MX" and "loading external .swf's with preloaders"... I got through them fine, and understand them and their logic, (I believe) with no problem. I was able get the AS to work perfectly in my own application UNTIL... I embedded the buttons themselves into a MC. I tried reworking the paths, but to no avail. the buttons "act" like buttons, but the AS never calls the external .swf, it's just dead.
I'm attaching a file that illustrates the use, and the way I've incorporated the AS. If anyone could help me sort this out I'd be very grateful...
Thanks a lot!
View Replies !
View Related
AS On Buttons Doesn't Work Inside MC's?
I need some help, I'm sure this is fairly simple, I just can't figure it out.
I found the tutorial on "loading into target for MX" and "loading external .swf's with preloaders"... I got through them fine, and understand them and their logic, (I believe) with no problem. I was able get the AS to work perfectly in my own application UNTIL... I embedded the buttons themselves into a MC. I tried reworking the paths, but to no avail. the buttons "act" like buttons, but the AS never calls the external .swf, it's just dead.
I'm attaching a file that illustrates the use, and the way I've incorporated the AS. If anyone could help me sort this out I'd be very grateful...
Thanks a lot!
View Replies !
View Related
GetChildByName Doesn't Work Inside AS File
Hi,
I am trying to get an open source Flex project to work in Flash, and currently the main issue I am having is that getChildByName doesn't work for some reason when called from an AS file that doesn't contain a class.
I admit I still haven't quite figured out the relationship between the main document class and additional AS files and how they connect...
Here's the situation:
In the AS file (in the Flex version) an already existing MovieClip (created in the main document class using scripting, i.e. it's not put on the stage using the interface) is being put into a variable.
In Flash, I get the error
1180 - Call to a possibly undefined method getChildByName
when trying to get the same task done.
My code for this line is:
var myClip:MovieClip = getChildByName("theClip");
I know I'll probably have to type cast it into a MovieClip, but I don't even get to that point yet.
I made sure that the MovieClip "theClip" has a name "theClip", and in other projects this has worked just fine.
I import flash.display.* to have access to DisplayObject.
There's gotta be something about AS files that I don't know yet that makes them behave differently, but I need to be able to access that MovieClip from within the AS file.
Any ideas?
Thanks!
View Replies !
View Related
MX:AS1: Function Doesn't Work Inside Loop
My maskImage functions will not trigger from inside of my loop function. If I place the tasks outside of the function it works but agian still not inside the loop. What am I doing wrong. Here is my code.
Attach Code
///////////////////////////////////
// --------- Variables -----------
///////////////////////////////////
var xPos = 0;
var INITIAL_XPOS = xPos;
var MAX_X = 572;
var yPos:Number = 0;
var i:Number = 0;
var j:Number = 0;
var ticker:Number;
var time:Number = 500;
///////////////////////////////////
// ------------ Loop --------------
///////////////////////////////////
init();
///////////////////////////////////
// ------- Setup Init() -----------
///////////////////////////////////
function init() {
ticker = setInterval(tick, 2000, this);
}
///////////////////////////////////
// -------- Image Loop ------------
///////////////////////////////////
function tick(MC) {
if ((++MC.j) == 1) {
_root.maskImage1();
trace("1");
} else if (MC.j == 2) {
_root.maskImage[j]();
trace("2");
} else if (MC.j == 3) {
_root.maskImage[j]();
trace("3");
} else if (MC.j == 4) {
_root.maskImage[j]();
trace("4");
} else if (MC.j == 5) {
j = 0;
//clearInterval(MC.ticker);
}
}
///////////////////////////////////
// ------ Tiling Function ---------
///////////////////////////////////
tileMe = function () {
if (i<150) {
holder1.attachMovie("square", "new"+i, i, {_x:xPos, _y:yPos});
xPos += 52;
// check if xPos ever gets greater than MAX_X then move to the next row
if (xPos>MAX_X) {
xPos = INITIAL_XPOS;
// increase the y postion each time
yPos += 52;
}
i++;
} else {
clearInterval(tileIt);
}
};
var tileIt = setInterval(tileMe, 5);
///////////////////////////////////
// --- Masked Image Function ------
///////////////////////////////////
// --------------------------------
// this works outside the function
/*
_root.createEmptyMovieClip("holder1", this.swapDepths(_root.x));
_root.attachMovie("image1", "image1_mc", 1);
_root.image1_mc.setMask(holder1);
_root.x += 2;
tileMe();
*/
// --------------------------------
///////////////////////////////////
function maskImage1() {
_root.x += 2;
_root.createEmptyMovieClip("holder1", this.swapDepths(_root.x));
_root.attachMovie("image1", "image1_mc", 1);
_root.image1_mc.setMask(holder1);
tileMe();
}
/*
////////////////////////////////////
function maskImage2() {
_root.x += 2;
_root.createEmptyMovieClip("holder2", this.swapDepths(_root.x));
_root.attachMovie("image2", "image2_mc", 1);
_root.image2_mc.setMask(holder2);
_root.x += 2;
tileMe();
}
////////////////////////////////////
function maskImage3() {
_root.x += 2;
_root.createEmptyMovieClip("holder3", this.swapDepths(_root.x));
_root.attachMovie("image3", "image3_mc", 1);
_root.image3_mc.setMask(holder3);
_root.x += 2;
tileMe();
}
////////////////////////////////////
function maskImage4() {
_root.x += 2;
_root.createEmptyMovieClip("holder4", this.swapDepths(_root.x));
_root.attachMovie("image4", "image4_mc", 1);
_root.image4_mc.setMask(holder4);
_root.x += 2;
tileMe();
}
*/
Edited: 02/05/2007 at 01:40:49 PM by breez11
View Replies !
View Related
TellTarget Doesn't Work Inside Functions?
I am creating a hangman-type game in Flash 5. To create the letter board with all the letters of the alphabet, I made a movie clip of a letter tile with a frame for each letter. There are 26 instances of the movie clip (Letter concatenated with A, B, C, etc. in order to have the correct letter display on each tile, I created the following function:
function setupLetters () {
tellTarget ("LetterA") {
gotoAndStop ("A");
}
tellTarget ("LetterB") {
gotoAndStop ("B");
}
etc through to...
tellTarget ("LetterZ") {
gotoAndStop ("Z");
}
View Replies !
View Related
OnEnterFrame Inside Prototype Doesn't Work
Check my little piece of code. Everything's going well, until the onEnterFrame. My MC instances aren't doin' anything!
Can anybody tell me what I'm doin' wrong?
ActionScript Code:
colors = [0x66FF00, 0x20DFD0, 0xEE1164, 0xDAE31C];MovieClip.prototype.drawCube = function(_moveY, _amount) { for (i=0; i<_amount; i++) { this.createEmptyMovieClip("cube"+i, i); this["cube"+i].lineStyle(1, colors[random(4)], 50); this["cube"+i].beginFill(0x2a0000, 80); this["cube"+i].moveTo(0, 0); this["cube"+i].lineTo(5, 0); this["cube"+i].lineTo(5, 5); this["cube"+i].lineTo(0, 5); this["cube"+i].endFill(); this["cube"+i]._x = random(Stage.width); this["cube"+i]._y = Stage.height-7; this.onEnterFrame = function() { this["cube"+i]._y -= _moveY; }; }};drawCube((random(7)+3), 10);
Thanks in advance!
View Replies !
View Related
AttachMovie Doesn't Work Inside For Loop
I have an xml file with 26 elements representing the alphabet so i can make a glossary (glossary.xml)
I am trying to attach a MC (pointer) for each letter/element in the xml file and add in the appropriate letter to a textbox (alpha_id) inside the MC.
However for some reason attachMovie won't work inside my for loop. Can anyone help me out here?
here's my code:
Code:
//load xml file
var external_xml:XML = new XML();
//ignore all extraneous whitespace
external_xml.ignoreWhite = true;
external_xml.load("xml/glossary.xml");
external_xml.onLoad = function(success:Boolean) {
if (success) {
temp_xml = this.firstChild;
lgh = temp_xml.childNodes.length;
for (i=0; i<lgh; i++) {
var alpha = temp_xml.childNodes[i].attributes.id;
//have also tried 'this._parent' as an experiment - no luck
this.attachMovie("pointer", "pointer"+i, this.getNextHighestDepth());
this["pointer"+i]._x = 40;
this["pointer"+i]._y = 40+(i*(this["pointer"+i]._height+10));
//there is a textbox instance named alpha_id in the mc pointer to accomodate each letter of the alphabet
this["pointer"+i].alpha_id.text = alpha;
}
}else {
trace ("Error");
}
};
View Replies !
View Related
Why Doesn't My Action Script Work?
[size=3]Thiundefineds animation should be when I drag the poop into the toilet, the toilet should splash...
This is what the object that moves say when I double click the poop:
ActionScript Code:
on (press) {
startDrag(this);
}
on (release) {
stopDrag();
if (this._droptarget == "/toilet") {
_root.toilet.gotoAndStop(2);
}
}
NOTE: the toilet is my object..
I put a keyframe onto each of my button sections in the poop
This is what the toilet says:
on the first frame when I double click it, it says
stop()
PLEASE reply and answer my question!!!!!!!
Very appricieated if helped...
Smat
View Replies !
View Related
|