AS3 - Reading Movieclips Inside Movieclips
hey all. i'm such a noob when it comes to AS3 but i'm determined to learn.
i've had to drop out of strict mode to make this work. can someone tell me why? i've a feeling it has to do with casting maybe. this is in an .as file and not on timeline.
trace(getChildByName("box1").playerStats.x);
in strict it throws up "1119: Access of possibly undefined property playerStats through a reference with static type flash.displayisplayObject."
yet trace(getChildByName("box1").x); works just fine.
also i want to refer to it dynamically with "box"+i. do i use this["box+i].playerStats.x?
edit: trace(getChildByName("box"+playerPos).playerCards.x); seems to work ok!
help!
Ultrashock Forums > Flash > ActionScript
Posted on: 2008-02-13
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Referencing MovieClips Inside MovieClips From The Main Time Line?
is it possible to have event listeners that listen for a movie clip inside a movieclip and then execute a function from the main time line?
Or is it impossible to relate something this far removed? Sounds like a geek Jerry Springer episode!
Something sort of like this:
Attach Code
movie1_mc.closeBtn1.addEventListener(movie1_mc.MouseEvent.CLICK, closeMenu1);
movie2_mc.closeBtn2.addEventListener(movie2_mc.MouseEvent.CLICK, closeMenu1);
function closeMenu1(e:Event):void {
if (e.currentTarget.name == "closeBtn1"){
movie1.gotoAndPlay(27);
movie1.visible = true;
} else if (e.currentTarget.name == "closeBtn2") {
movie2.gotoAndPlay(27);
movie2.visible = true;
}
}
Adding Movieclips Inside Of Two Other Movieclips... XML Powered Slideshow
hello..
I have been working on this project that used part of the kirupa.com tutorial for XML slideshows as a base. What it does is takes a set of thumbnails from an XML file and puts them in a movie clip on different layers. (Each thumbnail a new movieclip on a new layer of the original movieclip)
Anyways, what I am trying to do is make a menu movieclip pop up when a button is clicked. Inside this movieclip is where I want to throw the movieclip for thumbnails to load on. The menu movieclip is working fine and whatnot, but I cannot figure out how to get the thumbnails to load inside that second movieclip.
Here is a chunk of my code:
Code:
function createThumbnailScroller(current_mc, currentThumbFile, thumbCenter) {
thumbnail_scroller.createEmptyMovieClip("t"+current_mc, thumbnail_scroller.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(target_mc._width+20)*current_mc;
target_mc.pictureValue = thumbNumb[current_mc];
//trace(thumbNumbforJS[current_mc]);
target_mc.onEnterFrame = function() {
thumbWidth = target_mc._width;
};
target_mc.onRelease = function() {
//tell JS to jump to that slide
flash.external.ExternalInterface.call("jumpToSlide", thumbNumbforJS[current_mc] )
//set scroller movieclip back in its original position (go back to main screen)
yVal = 362;
scroller_move();
};
target_mc.onRollOver = function() {
fadeDown(this);
};
target_mc.onRollOut = function() {
fadeUp(this);
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(currentThumbFile, "thumbnail_scroller.t" + current_mc);
}
"thumbnail_scroller" is the movieclip which is inside of "scroller", the menu movieclip.
Thanks...
EDIT:
I got it working.. I just had to add "_root.movieclipname." in front of the movieclips I referred.
Adding Movieclips Inside Of Two Other Movieclips... XML Powered Slideshow
hello..
I have been working on this project that used part of the kirupa tutorial for XML slideshows as a base. What it does is takes a set of thumbnails from an XML file and puts them in a movie clip on different layers. (Each thumbnail a new movieclip on a new layer of the original movieclip)
Anyways, what I am trying to do is make a menu movieclip pop up when a button is clicked. Inside this movieclip is where I want to throw the movieclip for thumbnails to load on. The menu movieclip is working fine and whatnot, but I cannot figure out how to get the thumbnails to load inside that second movieclip.
Here is a chunk of my code:
Code:
function createThumbnailScroller(current_mc, currentThumbFile, thumbCenter) {
thumbnail_scroller.createEmptyMovieClip("t"+current_mc, thumbnail_scroller.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(target_mc._width+20)*current_mc;
target_mc.pictureValue = thumbNumb[current_mc];
//trace(thumbNumbforJS[current_mc]);
target_mc.onEnterFrame = function() {
thumbWidth = target_mc._width;
};
target_mc.onRelease = function() {
//tell JS to jump to that slide
flash.external.ExternalInterface.call("jumpToSlide", thumbNumbforJS[current_mc] )
//set scroller movieclip back in its original position (go back to main screen)
yVal = 362;
scroller_move();
};
target_mc.onRollOver = function() {
fadeDown(this);
};
target_mc.onRollOut = function() {
fadeUp(this);
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(currentThumbFile, "thumbnail_scroller.t" + current_mc);
}
"thumbnail_scroller" is the movieclip which is inside of "scroller", the menu movieclip.
Thanks...
Movieclips Inside Movieclips Problems
hi.
i have a mc called question13 which holds a number of other mc's inside it on the 12th frame, called tick1-tick6. each of these acts as a simple radio button with the following code (for tick1)...
on (release) {
if (_root.tick1select == 1) {
_root.question13.tick1.gotoAndStop(1);
_root.tick1select = 0;
}
else {
_root.tick1select = 1;
_root.question13.tick1.gotoAndStop(2);
}
}
These work fine as they are.
but i need to set the tick1 to look as though it is "ticked" (ie at frame 2) from the main timeline, not within question13, how do i do this?
Calling Other MovieClips Inside Other MovieClips
The problem I am having is a little moe signifcant than what the titles suggests.
What I am trying to do is to determine whether a movieClip, which is nested inside another a movieClip hits another moviceClip, which, you guessed it, is inside another movieClip.
Something along the lines of this:
Code:
onClipEvent(enterFrame){
if( _root.character.charNose_mc.hitTest( this )){
_root.character._x -= _root.char_speed;
}
}
Obviously this code is not working. The movieClip the hitTest( this ) is referring to is inside another movieClip. And charNose_mc is nested inside character at the root level. As you can tell, the goal of this code is to move the character movieClip in a negative direction using a predefined variable called char_speed.
Any ideas on what I am doing wrong, or what is the proper way to format this code? Thanks!
Why Do Movieclips Inside Movieclips Have Different _x And _y Than The Timeline?
I'm confused, why does a MC inside another MC have different _x and _y values than the main timeline?
What I am trying to do right now is animate a MC inside another MC then get the main MC holding everything to move where that new MC ended animating at (it's part of a game I'm making.)
I know it's confusing but Flash shows the cursors current X and Y in the info panel, which is the same as the main timeline. Yet inside the movieclip, an x of 76 and a y of 277 on the timeline is -195 and -30.9 (respectively) inside the MC.
How do I fix it so I can get the _x and _y values to match up so I can tell the main MC to reposition itself to the new X and Y (of the inside MC)
MovieClips Inside Other MovieClips - Detecting All
I have a movieclip called mapWindow, inside mapWindow are dynamically created movieclips of various sizes. The movieclips inside the mapWindow don't take up the entire space of the mapWindow and thus I use a startDrag on the mapWindow upon detection of a mouse press. The problem is, I don't want the start drag to start if the mouse is detected over any of the child movieclips inside mapWindow.
I have a few ideas of how to proceed, but I'm not sure how to reference all child movieclips of a particular movieclip - or something along those lines.
It would be easy to use the hittest function if I knew how to reference all the movieclips I need to, but alas...
Thanks in advance.
Calling Other MovieClips Inside Other MovieClips
The problem I am having is a little moe signifcant than what the titles suggests.
What I am trying to do is to determine whether a movieClip, which is nested inside another a movieClip hits another moviceClip, which, you guessed it, is inside another movieClip.
Something along the lines of this:
Code:
onClipEvent(enterFrame){
if( _root.character.charNose_mc.hitTest( this )){
_root.character._x -= _root.char_speed;
}
}
Obviously this code is not working. The movieClip the hitTest( this ) is referring to is inside another movieClip. And charNose_mc is nested inside character at the root level. As you can tell, the goal of this code is to move the character movieClip in a negative direction using a predefined variable called char_speed.
Any ideas on what I am doing wrong, or what is the proper way to format this code? Thanks!
Images Inside MovieClips Inside MovieClips
Hi. I'm trying to create a virtual photo album that you can drag photos into and rearrange them etc. The plan is to have it load/saveable using XML
In my library I have two MovieClips called Page and Photo.
Page is supposed to be able to contain many Photos. A Photo is supposed to hold or be an image (a photo).
I have declared two classes, Page and Photo, which are linked to their respective MovieClips
Actionscript:
class Page extends MovieClip {
private var _photo1:MovieClip;
function Page(){}
public function addPhoto(){
attachMovie("Photo", "_photo1", getNextHighestDepth());
_photo1.loadPhoto("File0025.jpg");
}
}
Actionscript:
import mx.controls.Loader;
class Photo extends MovieClip {
private var _photoLoader:Loader;
function Photo(){}
function loadPhoto(url){
trace("Inside Photo trying to load " + url);
_photoLoader = new Loader();
_photoLoader.load(url);
}
public function onPress(){
this.startDrag();
}
public function onRelease(){
this.stopDrag();
}
}
However, I can't get an image to show. The Photos have to be draggable so they have to be MovieClips. I can't use loadMovie() because I have to abe to control the size of the image. I'm trying to use Loader but I can't get it to work.
Question: What is the best way to allow my Page obj to have draggable images (which I'm trying to do as Photo objects)? I figured it has to use a Loader component.
Advice?
Movieclips Inside Movieclips
hi.
I am having problems with my game. I want to make bombs and for this i needed a movieclip 1 inside movieclip 2. When movieclip 1 is touched by the player the movieclip 2 plays. I have had no success so far and i cannot use such things as nameing the bomb as it wil take too long because i would like to c +p loads on the game.
Here are the codes i have tried:
code: onClipEvent(enterFrame) {
if(this.hitTest(_root.box))
_root.play ();
}
that made the main frame change.
code: onClipEvent(enterFrame) {
if(this.hitTest(_root.box))
play ();
}
this did nothing
i also tried this but it did not work.
code: onClipEvent(enterFrame) {
if(this.hitTest(_root.box))
_root.this.play ();
}
Have you got any ideas? i tried to provide code and my errors like i must. thanks
Visible Of MC Inside Other MovieClips
I use the code blow to load backgrounds only once in my movie as they are needed. I use the function to manage their _visible state so that if the background was already loaded I just make it visible and make all the other visible = false. I got the loading working and it seems that the properties are changing properly too, however I always see only my first background loaded and none of the other ones are showing. Can anybody tell me what is it that I'm doing wrong?
MovieClip.prototype.loadImage = function(instName, level, x, y, width, height, imgPath) {
var myMCL = new MovieClipLoader();
myMCL.onLoadInit = function (targetMC)
{
targetMC._x = x;
targetMC._y = y;
targetMC._width = width;
targetMC._height = height;
};
this.createEmptyMovieClip(instName, level);
myMCL.loadClip(imgPath, this[instName]);
delete myMCL;
};
function addBackground(bgFile) {
if (_root.bg == undefined) {
_root.createEmptyMovieClip("bg", 99);
_root.bg._x = _root.text_scp._x;
_root.bg._y = _root.text_scp._y;
_root.bg.bgCount = 0;
_root.bg.bgArray = new Array();
}
if (showBG(bgFile) == false) {
_root.bg.loadImage("BG" + _root.bg.bgCount, _root.bg.bgCount, 0, 0, _global.defaultMovieWidth, _global.defaultMovieHeight, _global.backgroundImage);
_root.bg.bgArray[_root.bg.bgCount] = bgFile;
//trace("Added New Background: "" + _root.bg.bgArray[_root.bg.bgCount] + "" at position " + _root.bg.bgCount + " with name "" + _root.bg["BG" + _root.bg.bgCount]._name + """);
//trace("Element added has now visible set to "" + _root.bg["BG" + _root.bg.bgCount]._visible + """);
_root.bg.bgCount = _root.bg.bgCount + 1;
}
}
function showBG(filePath) {
var rtVal = false;
//trace("Call ShowBG with count: " + _root.bg.bgCount);
if (_root.bg.bgCount > 0) {
for(i = 0; i < _root.bg.bgCount; i++) {
//trace("Element " + i + " has " + _root.bg.bgArray[i] + " and we are setting visible to "" + (_root.bg.bgArray[i] == filePath) + """);
_root.bg["BG" + i]._visible = (_root.bg.bgArray[i] == filePath);
rtVal = ((rtVal) || (_root.bg["BG" + i]._visible));
//trace("Element " + _root.bg["BG" + i]._name + " has now visible as " + _root.bg["BG" + i]._visible);
}
}
return rtVal;
}
Buttons Inside Movieclips
Hi, using FlashMX(6) here and i am having trouble with buttons inside movieclips. I have a basic dialog in the form of a MC that comes up with "ok" and "cancel" options. Within my Actionscript i have
EXAMPLE;
attachMovie("NewDialogue","myDialogue",2);
myDialog.OKButton.onRelease = function(){
myCode;
}
Here is the thing. It works perfectly fine when the dialog is called up from the main script (like above), either within a function or outside.
But when this dialog is attached via clicking on another button, the Dialog appears but the buttons not longer work when you click them.
EXAMPLE;
attachMovie("NewButton","Button",1);
CreateDialogueButton.onRelease = function(){
attachMovie("NewDialogue","myDialogue",2);
}
All i can think of it resorting to Hit-testing, but i would prefer to find out why my current method does not work.
Thanks for your time
irreal
Buttons Inside Movieclips
ok, so i'm making a site, for the links banner i have a movieclip that scrolls in a infinite loop. the banner is a single image and i'm using invisible buttons over the different parts for the links.
the problem is that even though i know the code on the buttons is correct, they just don't work. my guess is that it has something to do with the fact that the buttons are inside another movieclip. the movieclip the buttons are inside already have some code that uses the mouse (it's one of those deals where the position of the mouse over the movieclip determines the speed the movieclip moves at). i think that since the outer movieclip is already using the mouse, it's blocking the buttons inside it from getting recognized.
but that's just my guess. any help would be great.
thanks.
[CS3] MovieClips Inside A Movieclip
Flash is making me feel like a damn fool. Granted I've only been using it for a few weeks.
Alright, so I've got a bunch of movieclips inside of another movieclip. Inside the movieclip (called star_mc) I have another movieclip called mcStarburst, that I want to play when I roll over the clip. I have a frame with the stop(); command on the first line.
When I run the thing though, I just get a bunch of errors. I can't click on the thing and get a trace statement in my output, and the starburst animation just plays over and over again, completely disregarding my stop command.
And on top of that not even my buttonMode works right. What gives?
Here are the errors:
1119:Access of possibly undefined property mcStarburst through a reference with static type Function.
1061: Call to a possibly undefined method addEventListener through a reference with static type Class.
1061: Call to a possibly undefined method addEventListener through a reference with static type Class.
1119: Access of possibly undefined property buttonMode through a reference with static type Class.
And here is the code I'm using:
star_mc.addEventListener(MouseEvent.CLICK, onClick);
star_mc.addEventListener(MouseEvent.ROLL_OVER, playStarBurst);
function onClick(event:MouseEvent):void
{
trace("Ok this better work")
}
function playStarBurst(event:MouseEvent):void
{
play.mcStarburst;
}
star_mc.buttonMode = true;
Preloader Inside Movieclips?
Hi,
I've made a movieclips gallery, where each button plays another movieclip. the problem is a few of the movieclips are quite big and runs slowly. how can I create a preloader inside the movieclips?
thanks in advance,
uriash
Embed 2 MovieClips Inside Of 1
Hey.
At the moment, I think I may have figured out my problem, but maybe I haven't. I need to get this thing to work if I want it to work. I was wondering if I have 2 movie clips, each holding an image loaded by loadclip where the second image is supposed to be 80 pixels below the first, how I would make it so that these are combined into 1 new movieclip object
Thank you.
Buttons Inside Movieclips
Hello everybody....
I am relitivley new to Flash and using action script and I am having a problem getting the buttons in my menu to work.
I have a menu which slides in from the bottom when a invisible button is rolled over and slides out when you rollout of the menu, this works fine....
inside this movie clip I have 5 navigation buttons which fade in when the menu has slided out completely but the problem is they dont work....
I have tried putting the code on the keyframe of the mc when the menu is fully out and is in a static position and also inside the buttons themself but neither worked....
Code:
contact_btn.onRelease = function(){
getURL("http://google.co.uk");
}
Code:
on(release){
getURL("http://google.co.uk");
}
I can make working buttons on the main stage no problem but I am pulling my hair out trying to get buttons that are inside a movieclip to work, am I going about this the wrong way or have I missed something?
any help is greatly appreciated.
Buttons Inside Movieclips
I have a movieclip named blueHome...
in my first frame, I use the following code:
Code:
blueHome.useHandCursor = false;
blueHome.onRollOver = function () {
blueHome.gotoAndStop(2);
}
blueHome.onRollOut = function () {
blueHome.gotoAndStop(1);
}
in frame 2 of blueHome, I have 3 buttons that don't work (as in, when I rollOver them, the hand cursor does not appear, the buttons do not switch to the "Over" frame, and when I attempt to click on them, it doesnt work...
Why is this happening, and what can I do to make the buttons work?
I've tried moving the buttons outside the movieclip and into a frame just above it (so that when I rollOver the movieClip, it makes the buttons visible, and when I rollOut, it makes them invisible)...but the problem is, when I rollOver the buttons, then macromedia treats it as if I've rolled out from the movieClip...
are there any other options?
Movieclips Inside Sprites
for some reason i get errors when i try to put movieclips inside sprites...
like
Code:
package com.Huh
{
import flash.display.Sprite;
import com.Huh.Innards;
public class Wow extends Sprite
{
public function Wow()
{
var myInnards:Innards = new Innards();
addChild(Innards);
}
}
}
and then
Code:
package com.Huh
{
import flash.display.MovieClip;
public class Innards extends MovieClip
{
public function Innards()
{
trace('im here');
}
}
}
doesn't let me. i guess if there are ANY movieclips inside something all the parent display objects MUST be movieclips? is that true?
or am i just missing something here...
ty in advance!
Buttons Inside Movieclips
I nested my footer buttons inside a movie clip so that I could align them all to the bottom of the stage without changing their distribution to one another. However, when I test my flash movie these buttons are not affected by a mouse rollover or when they are clicked. How can I get a button's down/over roll over effects to act from within a movieclip? I've attached the fla source so u can better understand my dilemma. All suggestions welcome n thanks in advance for the help!
Buttons Inside Movieclips
Hey fellas, I got a problem with this image scroller panel I made. It's made out of a movieclip, and inside there are 9 thumbnails, which all are buttons. Now my problem is that I don't know how to address the buttons inside my movieclip. I want to give the buttons inside my movieclip and action like, oprelease gotoandstop. Basically just jump to another frame in the timeline. THis is my code for the image panel scroller. It scrolls up and down depending on the mouse position inside the stroke. This is the code.
Code:
panel.addEventListener(MouseEvent.MOUSE_OVER, panelOver);
function panelOver(event:MouseEvent):void {
panel.removeEventListener(MouseEvent.MOUSE_OVER, panelOver);
panel.addEventListener(Event.ENTER_FRAME, scrollPanel);
}
var b:Rectangle = stroke.getBounds(this);
function scrollPanel(event:Event):void {
if(mouseX < b.left || mouseX > b.right || mouseY < b.top || mouseY > b.bottom) {
panel.removeEventListener(Event.ENTER_FRAME, scrollPanel);
panel.addEventListener(MouseEvent.MOUSE_OVER, panelOver);
}
if(panel.y > 617.6) {
panel.y = 617.6;
}
if(panel.y < 387.7) {
panel.y = 387.7;
}
var ydist = mouseY - stage.stageWidth / 2;
panel.y += -(ydist / 7);
}
Now this works fine, I have a problem however when I want to give the buttons INSIDE the MC an action. I want the project to jump to a certain frame on the timeline, when u click on a button. So i got the advice to add the following code to my actions.
Code:
/*--------------------------------------------------------------------------------------------------
mouse events will, by default, propagate down to the children of the movieclip "panel".
This script should work as is for an unlimited number of nested movieclips.
Weak reference is set to true in the event listener to improve GC performance.
--------------------------------------------------------------------------------------------------*/
panel.addEventListener(MouseEvent.CLICK, imgClick, false, 0, true);
var imgName:String = "";
function imgClick(e:MouseEvent):void {
imgName = event.target.name;
trace(imgName);
gotoAndStop(imgName);
/*--------------------------------------------------------------------------------------------------
This function sends the playhead to the frame label that matches the instance name of the event.target.
So, for example, if you click image "img1", the playhead will go to frame label "img1".
All you have to do to make this work is to name your frame labels accordingly.
--------------------------------------------------------------------------------------------------*/
}
So I added it, gave frames in my timeline a label name, matching the buttons instance name. So theoretically it should jump to the label on the timeline. However I get the following error.
Code:
1120: Access of undefined property event. source: name=target.event.name;
Does anyone know how to solve this? Thanks in advance!
MovieClips Inside MovieClip
Hi everyone,
Im trying to get the number of mcs that I have inside another one:
Code:
var mc1:MovieClip = new MovieClip();
var mc2:MovieClip = new MovieClip();
var mc3:MovieClip = new MovieClip();
mc1.addChild(mc2);
mc1.addChild(mc3);
for ( var i in mc1 ) {
trace( i ); //this used to work in AS2
}
my problem is that it even doesn't get inside the for loop for the trace... :P
is there any other way to get to the movieclips inside another movieclip?
THKX,
Loading XML Inside MovieClips
Hi all,
Got the following problem:
I'm trying to load an XML file in Dynamic text fields that are
placed inside movieclips. Nothing is loaded.
Anyone knows what code is necesary to load an XML data in
dynamic texts that are in movieclips inside movieclips?
Maybe a special way to write the path?
thanks for your help!
Buttons Inside Movieclips
code on root timeline
stop();
var links = new Array("about", "closet", "contact", "links");
for (var i = 0; i<links.length; i++) {
link = links[i]
trace(links[i]);
_root[links[i]].item_button.onPress = function() {
trace(links)
trace(i)
trace(links[i])
trace(links[1])
};
}
i dont understand why this does not work.
the links array are movieclip names
and item_button is the button inside the movieclip names.
example about.item_button.
everything traces except when i try to access an array index using the variable i it returns undefined! but when i access an array hardcoding the number it returns the correct value. very akward...
Buttons Inside Movieclips
Hey fellas, I got a problem with this image scroller panel I made. It's made out of a movieclip, and inside there are 9 thumbnails, which all are buttons. Now my problem is that I don't know how to address the buttons inside my movieclip. I want to give the buttons inside my movieclip and action like, oprelease gotoandstop. Basically just jump to another frame in the timeline. THis is my code for the image panel scroller. It scrolls up and down depending on the mouse position inside the stroke.
panel.addEventListener(MouseEvent.MOUSE_OVER, panelOver);
function panelOver(event:MouseEvent):void {
panel.removeEventListener(MouseEvent.MOUSE_OVER, panelOver);
panel.addEventListener(Event.ENTER_FRAME, scrollPanel);
}
var b:Rectangle = stroke.getBounds(this);
function scrollPanel(event:Event):void {
if(mouseX < b.left || mouseX > b.right || mouseY < b.top || mouseY > b.bottom) {
panel.removeEventListener(Event.ENTER_FRAME, scrollPanel);
panel.addEventListener(MouseEvent.MOUSE_OVER, panelOver);
}
if(panel.y > 617.6) {
panel.y = 617.6;
}
if(panel.y < 387.7) {
panel.y = 387.7;
}
var ydist = mouseY - stage.stageWidth / 2;
panel.y += -(ydist / 7);
}
[CS3] Simple Display List Problem (MovieClips In MovieClips)
I have an object called UI_Total which contains 3 objects called Star, instanced as star1 star2 and star3.
In my code I do the standard:
PHP Code:
mainUI=new UI_total;
addChild(mainUI);
to instance the UI_Total.
Now, I can do something like
PHP Code:
mainUI.star3.x+=500
no problem.
And when I do
PHP Code:
trace(mainUI.star3.parent)
I get [object UI_Total] as expected.
Would someone be so kind as to explain to me then why
PHP Code:
mainUI.removeChild(star3)
doesn't work, and also why I can't do anything like
PHP Code:
mainUI.getChildIndex(star3)
Text Fields Inside MovieClips
It seems that text fields placed inside movieClips have certain limitations such as not allowing user input and not responding to the alpha settings of the instance of the movieClip. Can someone confirm this? if so how you get around it?
Variables` Exchange Between 2 MovieCLips (one Inside The Other)
Please help me!...
I can use variables only inside the movie clip. If I have sub-movieclip inside the main MC, formulas inside sub-mc don`t work!!! Please if anyone know where can I read about this problem (a tutor) please give me the link (URL). I tryed to find it by myself but I still got nothing Thank You in advance.
Levels And Scrollpanes And The Movieclips Inside
Okay, I originally asked about fading a scrollpane in or out, but since then I've decided that it might help my site run better if I just loaded different movie clips within the scrollpane. However, my navigation buttons are on level 4 and the scrollpane in question is on level 3. I am unsure what AS I need to make the scrollpane load a different movie clip inside. . .any help will be very very much appreciated by this Uber-Newbie.
Getting Buttons To Work Inside Movieclips
I'm having troubles getting buttons to work inside of a movieclip - the clip is draggable, but buttons only affect actions within that clip and not the Stage.
So how for instance, would I get a button inside a movieclip, to change scenes via the Stage when clicked?
Any ideas would be appreciated. Thanks.
Buttons Inside Draggable Movieclips
Hey
This is probably really stupid but it's really puzzling me...
I have a movie clip which I can drag around but would like to have buttons and scrollbars in it... Obviously if I try and put them inside of the movieclip when I try and click them it's just the same as dragging it but on the other hand if I try and put them outside the movieclip they don't get dragged around with it.
What do I do
Any help would be fantastic
Thanks
Accessing Buttons Inside MovieClips
Hi
I have MovieClip menu and there are some buttons inside the MovieClip. Im trying to access the buttons and I want the code all together so I dont want to put the code inside the button.
However I dont seemed to be able to access it outside. Im using the code below.
myMovieClip.myButton.onRelease = function() {
trace("Hello");
};
Can some please help?
Linking Movieclips Inside Scenes
I have 4 movieclips on a scene. I'm trying to link them to each other. For instance when I go into the first movieclip (which is on scene 1, frame 1) one the buttons is supposed to link to the 2nd movieclip. Let's say the second moviclip is on scene 1 on the 60th frame. For the button I have the actionscript:
on (release) {
gotoAndPlay("scene1", 60);
}
it doesn't give me an actionscript error, but it doesn't do what I want it too. It just plays the same 1st clip over again when I click the button (the one that is supposed to go to scene 1 and play frame 60).
Can someone tell me what I'm doing wrong?
Thanks so much!
Linking Movieclips Inside Scenes
I have 4 movieclips on a scene. I'm trying to link them to each other. For instance when I go into the first movieclip (which is on scene 1, frame 1) one the buttons is supposed to link to the 2nd movieclip. Let's say the second moviclip is on scene 1 on the 60th frame. For the button I have the actionscript:
on (release) {
gotoAndPlay("scene1", 60);
}
it doesn't give me an actionscript error, but it doesn't do what I want it too. It just plays the same 1st clip over again when I click the button (i.e. the one that is supposed to go to scene 1 and play frame 60, plays scene 1 frame 1).
Can someone tell me what I'm doing wrong?
Thanks so much!
Accessing Movieclips Inside A Loaded Swf
I have a movie where I am loading in a .swf file. This swf file has movieclips in it that are generated by a class. Essentially, the point of the class is to see movieclips inside of my external swf, duplicate them, then delete the originals so that the movieclips now have the methods and properties of my class avaliable for their use. Okay, now onto my problem. I compile this movie and it works fine. but when i try to access these movieclips from the main movie, like if i print out its abssolute path (with level0. blah blah), then it will trace nothing. this is driving me insane. any ideas?
Buttons Inside Movieclips Not Working
So. I have a splash page. I use a javascript code in my getURL to make the splash page, which contains a button, open my main page in a fixed size window. The main page has draggable movieclips that have buttons in them. (Well, right now only one has a button.) I used the exact same coding on this button with only a different url to open another new page with a photogallery, and it won't open at all. But if I place the button by itself on the main timeline (not nested in an MC) it will open, but not in a new window.
Anyone have any idea what's going on?
This is the link to the website zipped.
Referencing Inside Movieclips Gives 1119
I have searched actionscript.org and the web in general for a solution to this but I have been unable to find an answer.
The issue is this I have a class that extends Loader. This class loads a compiled .swf. I need to do some actions to movieclips nested inside the loaded movieclip. I reference the nested mc's by this.content.mc1, this.content.mc2 ...
With strict mode turned on I get this message
"1119: Access of possibly undefined property mc1 through a reference with static type flash.displayisplayObject."
If I turn off strict mode everything works fine but then I miss out on the compile time error checking fun of as3. Any help would be greatly appreciated
-Derek
Get MovieClips Nested Inside Another MovieClip.
Hi.
I have a MovieClip named mcContainer. This MovieClip contains several MovieClips, mc01, mc02,..., mcN. I'm pretty sure there must be a way to automatically build an array containing the names of those MovieClips, I'm just missing how. Can anyone give me a hand?
Thank you in advance.
Nested Button Inside MovieClips
I am sure I must be doing something very stupid but here goes:
This is for a navigation bar.
- I have a main movie (mcMenu) on my stage which holds all the main buttons (btnHome, btnAbout, etc..).
- Inside mcMenu, when I roll over say btnAbout, the movie plays from 10 to 20th frames during which time a submenu fades into view.
- Inside this submenu, I have the sub-section buttons. It is these buttons that I am having problems with. Basically, I can't get them to respond to onRelease events.
What could I be doing wrong?
Thanks.
Accessing Variables Inside Other Movieclips.
I'm currently learning OOP through Sen's information here at Kirupa, and I've decided to try out his "creatures" exercise mentioned in his Best of Senocular thread...I still have a bunch to learn, but I wanted to go ahead and ask a question for a problem I am having right now.
The situation is a random number of sprites are created, and they move around the stage, interacting. They all have a certain amount of "health," defined as a variable in a MovieClip prototype applied to the MC. When they hit, I want their health to go down a little bit, so how can I access a particular MC's "health" variable while I'm outside of the MC itself?
Create Textfields Inside A New Movieclips?
Hi !
Still have problems with this after several hours of blood, sweat and tears .
My goal is to make a interface where you can input text, push a button and the text appears in the center of the stage. After that the text can be rotated, moveable, you can change font, size and color. As it is now you can create only one textfield and change color of the text, nothing more...
Im having problems. Works fine when I create the first textfield, but when the button is pushed the second time it just overwrites the first field. Im using getNexthighestDepth to get a new clip with new text in it everytime I push the button. It´s also not possible to drag the text around the screen.
So my questions are, how do I create a new textfield everytime I push the button without overwriting the old one and why does not the drag function work? Code below.
Code:
//When the button called "knappast" is pushed a movieclip is created
//and also a textfield inside the movieclip. The textfield contains the text
//from the textinput field called "textin".
//Problems with this: Everytime you push the button it overwrites the last
//created text.
createEmptyMovieClip("mc", getnexthighestdepth());
mc.createTextField("txt1", 0, 200, 175, 200, 35);
mc.txt1.border = true;
mc.txt1.background = true;
mc.txt1.autoSize = "left";
mc.txt1.selectable = false;
mc.txt1.text = textin.text;
}
//You are then supposed to be able to drag the movieclip with the
// textfield, but that isnt working.
mc.onPress = function() {
this.StartDrag();
};
mc.onRelease = function() {
this.StopDrag();
};
Multiple Movieclips Inside One Movieclip
Hi,
This should be simple but I can't figure it out... I have a master movieclip and I would like to create further movieclips within this one and load images in these. Here is how I did this:
var ThumbHolder:MovieClip = this.createEmptyMovieClip(mcThumbHolder,this.getNe xtHighestDepth());
var Thumb1:MovieClip = ThumbHolder.createEmptyMovieClip(mcThumb1,mcThumbH older.getNextHighestDepth());
var Thumb2:MovieClip = ThumbHolder.createEmptyMovieClip(mcThumb2,mcThumbH older.getNextHighestDepth());
Thumb1._x = 0;
Thumb1._y = 0;
Thumb2._x = 250;
Thumb2._y = 250;
loadMovie("images/thumb_1.jpg",Thumb1);
loadMovie("images/thumb_2.jpg",Thumb2);
The movieclips are created but Thumb1 is not visible, it's hidden under Thumb2! What am I doing wrong?
Any help is much appreciated!
Buttons Inside Nested Movieclips
I have a movieclip (mc1) which consists of a mask and another movieclip (mc2). mc2 has 3 buttons. One code that I attached to one of the buttons (and which doens't work) is as follows:
on (release) {
getURL("http://science.nasa.gov/");
}
why doesn't that work?
mc1 has the following code:
on (rollOver) {stop();}
on (rollOut) {play();}
which works ok.
[Flash 8]Movieclips Inside Buttons
Hey Kirupa,
I'm working on a game right now, and I'm having a bit of trouble. I would like it to be if a certain Boolean, lets call it variable1 is equal to true, then Movieclip "disk" (which is located inside a button) goes to the next frame.
I set up the variable as such:
PHP Code:
var variable1:Boolean = false;
I then set up a function:
PHP Code:
function checkDisk() {if (variable1 == false){mybutton.mymc.nextFrame();}}
I put the function in an event handler, but when I tested it, and performed the action which sets variable1 equal to true, the disk stayed how it was.
I tested it on a movieclip not inside a button and it worked fine. Any suggestions?
Gradient Masks Inside Movieclips?
why doesn't it work? It works fine on the main timeline with the code below, but not inside a movieclip. Is there a workaround?
mask_mc.cacheAsBitmap = true;
image_mc.cacheAsBitmap = true;
image_mc.setMask("mask_mc");
Nested Button Inside MovieClips
I am sure I must be doing something very stupid but here goes:
This is for a navigation bar.
- I have a main movie (mcMenu) on my stage which holds all the main buttons (btnHome, btnAbout, etc..).
- Inside mcMenu, when I roll over say btnAbout, the movie plays from 10 to 20th frames during which time a submenu fades into view.
- Inside this submenu, I have the sub-section buttons. It is these buttons that I am having problems with. Basically, I can't get them to respond to onRelease events.
What could I be doing wrong?
Thanks.
Accessing Variables Inside Other Movieclips.
I'm currently learning OOP through Sen's information here at Kirupa, and I've decided to try out his "creatures" exercise mentioned in his Best of Senocular thread...I still have a bunch to learn, but I wanted to go ahead and ask a question for a problem I am having right now.
The situation is a random number of sprites are created, and they move around the stage, interacting. They all have a certain amount of "health," defined as a variable in a MovieClip prototype applied to the MC. When they hit, I want their health to go down a little bit, so how can I access a particular MC's "health" variable while I'm outside of the MC itself?
Clicking On Movieclips Inside Another Movieclip
Hi there,
I'm having a whole lot of trouble with some nested movie clips. Here's the situation.
I'm duplicating movieclips inside a container movieclip. That works fine. My problem is, the onPress event that I assign to them doesn't fire. It appears that the container movieclip is "blocking" it's children movieclips.
I've been trying all the Propagation work-arounds but nothing seems to work.
The Goal: I want to click on one of the "parts" in th left side menu and i want it to trace one of it's properties. At this point, if it traced "Hi" i'd be happy. I just want it to fire when i click on it.
I'm not able to upload the files so you can find them here:
http://www.cybertekresearch.com/sharing/share.html
the files are called Parts.as and parts.fla
I'm pretty sure the pertinent code is between line 81 and 99 of the .AS file.
Thanks
|