Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




[f8]Loading A MovieClip From Another MovieClip In The Stage



Hi, i just learn flash and AS and now i am trying to build a menu with submenu.
I have 2 files :

a. loader.swf
b. menu.swf

Condition :
1. Loader.swf has a button that loads menu.swf into stage via createEmptyMvieClip.
2. Menu.swf have sets of button that supposed to load a jpeg/clip to Loader stage which acting as a "submenu".

And my question is :

Is it possible to load a clip from a loaded menu.swf into Loader.swf stage?


I have this code that individually works but not when i load the menu.swf. The map.swf won't load into Loader stage.


Code:
== loader.swf ==

_root.createEmptyMovieClip("menu",0);
menu.loadMovie("menu.swf");

Code:
== menu.swf ==
btn1.onPress = function () {
_root.createEmptyMovieClip("container", 1);
container.loadMovie("new_mohome/map.swf", 2);
}
btn2.onPress = function () {
_root.createEmptyMovieClip("container", 1);
container.loadMovie("new_mohome/map.swf", 2);
}
btn3.onPress = function () {
_root.createEmptyMovieClip("container", 1);
container.loadMovie("new_mohome/map.swf", 2);
}



FlashKit > Flash Help > Flash Newbies
Posted on: 08-03-2008, 11:05 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Loading A Movieclip On The Main Stage From A Button Within A Movieclip - Big Headache
Hi there,

i am trying to put together a portfolio site, which uses a 'floating' panel with buttons on it. In order for it to move around it has to be a movieclip. So all the buttons are stored within a single movieclip, which is giving me a headache because i want those buttons to load other movieclips from my library onto the main stage (as like a popup window within the flash)

Its all slightly confusing. i have tried using this code based within the movieclip where my button is based:

button_play.buttonMode = true;
button_play.addEventListener(MouseEvent.CLICK, OpenBox);
function OpenBox (e:MouseEvent):void{
this.addChild(new mc_box());
}


button play is within a movieclip called mcTweenMe2 (which is on the main timeline) and i want the movieclip to be loaded on the main timeline (not within in the movieclip where the button 'button_play' is based) mc_box is the movieclip i wish to load on the main timeline (in the centre) with the ability to close it also!

Bit of a headache, please help me someone i have run out of sites to look for answers!

PS: does anyone know why stop (); wont stop my timeline playing like it used to in AS2? beacause another option for making my site work is making this button target labeled frames in the main timeline, however stop (); don't seem to work now!

Thanks!

? Resize Stage To Dynamically Match External Movieclip Loaded Into Empty Movieclip
Hi all,
Does anyone know how I can resize the stage to match the size of an external graphic/movieclip which is loaded into an empty movieclip,
thanks

? Resize Stage To Dynamically Match External Movieclip Loaded Into Empty Movieclip
Hi all,
Does anyone know how I can resize the stage to match the size of an external graphic/movieclip which is loaded into an empty movieclip,
thanks

? Resize Stage To Dynamically Match External Movieclip Loaded Into Empty Movieclip
Hi all,
Does anyone know how I can resize the stage to match the size of an external graphic/movieclip which is loaded into an empty movieclip,
thanks

Load Movieclip From Libary Into Another Blank Movieclip On Stage (URGENT PLEASE)
hi all i just need to know how to load a movieclip into a blank movie clip all in the same movie?! please help many regards peter thanks in advance!

Loading MovieClip Into A Scalable Stage
I've got this bit of code on my first frame, which allows me to place clips or buttons at specific locations within a fullscreen background:


HTML Code:
//start Stage re-size code
Stage.align = "LT";
Stage.scaleMode = "noScale";
// ---> Create a new listener object
var stageListener:Object = new Object();
// ---> Define the resize function...
stageListener.onResize = function() {
// ---> first, get the new dimensions of the stage....
var stageWidth:Number = Math.round(Stage.width);
var stageHeight:Number = Math.round(Stage.height);
trace("Stage size is now " + Stage.width + " by " + Stage.height);
// ---> now, set the footer BG w & h to the stage dimensions...
footerBG_mc._width = stageWidth;
//footerBG_mc._height = stageHeight;
footerBG_mc._x = 2;
footerBG_mc._y = stageHeight-25;
// ---> now, set the footer links to the stage dimensions...
footerLinks_mc._x = (stageWidth/18) - (footerLinks_mc._width/2) ;
footerLinks_mc._y = stageHeight-200;
// ---> now, set the background clip alignment to match stage...
wallPaper_mc._x = (stageWidth/2) - (wallPaper_mc._width/2);
//wallPaper_mc._y = stageHeight/2;

// ---> now, size the outLine_mc to the stage dimensions...
outLine_mc._height = stageHeight-2;
//outLine_mc._width = stageWidth;
outLine_mc._x = (stageWidth/2) - (outLine_mc._width/2);
//outLine_mc._y = (stageHeight/2) - (wallPaper_mc._height/2);

};
// ---> Apply the listener...
Stage.addListener(stageListener);
// ---> Run the function...
stageListener.onResize();

//--------------------//

I've now added some buttons to the stage, and want to load movieClips using this bit of actionScript:


HTML Code:
on (release) {
this.attachMovie("mcSpecialists","mcSpecialists",10);


}
The question is, how can I load the mcSpecialists movieClip so that it's always at the center of the stage?

Thanks

AS 2 Loading A Random MovieClip To Stage
I HAVE FIGURED THIS OUT, THANKS. PLEASE DELETE THIS THREAD!

I have been searching for this all day, and though I've seen many threads about it I still don't get it so any help is appreciated.

I have about 6 different movieclips that I would like to have load randomly to the stage when the flash starts, so each time you load the swf it's a random clip out of those 6. I had found a method that does what I want for AS 3.0 but I need this for AS 2.0

Can anyone please help me? Any help is greatly appreciated, thanks.

Loading A MovieClip From The Library Into An Empty MoveClip On The Stage...
Hi!

I'd imagine that the solution to this one should be pretty straight forward...

Okay then, what I want to do is to load a moveClip from the library into an empty "placeHolder" movieClip that is on the stage.

This will happen on the press of a button so it will be within;

on(release){

}


If anybody can help me implement this, thankyou.

Extend Class Movieclip And Movieclip Off Stage
Hi all,
Using Flash 8 and getting over to AS2.0 I got this problem. Could not find any answer on the forum until now.

I am trying to get some more grips on AS2.0 and do this by making a small game. On several frames are movieclips: mc1 mc2 etc. When the user clicks on them, the total number of clicks is recorded (among others) for each movieclip. On different frames are different movieclips.
I tried three ways.

1. First I defined a class MyMovieClipClass extends MovieClip with:
code:
private var clicks: Number
private function onPress: Void {
clicks++;
// do other things
}
public function howMuch: Number{ // return clicks }

Movieclips mc1, mc2, etc are defined being a member of this class in ‘linkage’.
The problem arose that when on a frame without mc1 I could not access mc1.howMuch() becase in that frame there is no mc1.


2. Then I defined two classes MyMovieClipClassA and MyMovieClipClassB
The movieclip on stage mc1 is a member of Class A and var clicks is in Class B.
The instance name of class B is derivated from the instance name on stage:
mc1 (ClassA) is kindof connected with mc1_obj (ClassB)
MyMovieClipClassA extends MovieClip with:
code:
private function onPress: Void {
// make instName = this._name + “obj”;
instName.clicks++;
// do other things
}


MyMovieClipClassB with:
code:
private var clicks: Number
public function howMuch: Number{ // return clicks }


In the timeline I then define:
code:
var item1: MyMovieClipClassA = new MyMovieClipClassA();
var item1_obj: MyMovieClipClassB = new MyMovieClipClassB();

which is not very elegant.
(the movieclip to which this belongs has the name item1)

3. I tried to declare ‘_name + “_obj”’ in de constructor of ClassA but did not succeed.

Anybody any suggestions for an elegant solution in which different movieclips in different frames on stage can be tracked using classes?
Thanks in advance for your reaction.

Load Movieclip From Library Into A Movieclip On The Stage?
Alright I am losing my mind trying to figure out something so simple, I can load external swfs no problem, but How do you access a movieclip from the library?

I have a main swf, and a movieclip in the library named feb93_mov. Basically I want to on MOUSE_DOWN load the library item "feb93_mov" into swfloader_mc on the stage. But I cant write an instance name for "feb93_mov" cause it's not supported, so how do I access it then?

Here is my code what is wrong with it?:


ActionScript Code:
feb93_btn.addEventListener(MouseEvent.MOUSE_DOWN, feb93down);
function feb93down(event:MouseEvent):void
{
    loadMe4();
}

var loadMe4 = function():void
{
        var feb93_mov:MovieClip = new MovieClip();
    swfloader_mc.addChild(feb93_mov);
}

How To Target A Movieclip Within A Movieclip On The Stage (in A Class)
Peepz,

Im building a scroll class which looks like this:

ActionScript Code:
package { import flash.display.Sprite; import flash.events.MouseEvent; import flash.events.Event; import flash.geom.Rectangle; import flash.display.DisplayObjectContainer import flash.display.MovieClip; public class ContentScroller2  {        //eigen code   private var moveSpeed:Number   private var easingSpeed:Number   private var scrollHeight:Number   private var percentScrolled:Number   private var newY:Number            // how much of the movie can be scrolled   private var scrollable:Number   private var initContentPos:Number        // the drag positions that are possible for the mcDragger   private var left:Number   private var top:Number   private var right:Number   private var bottom:Number   private var scrollWheelSpeed:Number        private var _mcContent:Sprite   private var _mcMask:Sprite   private var _mcDragger:Sprite   private var _mcTrack:Sprite      private var dragBounds:Rectangle;   public function ContentScroller2(mcContent:Sprite, mcMask:Sprite, mcDragger:Sprite, mcTrack:Sprite, ease:Number, setDraggerSize:Boolean = false)   {           _mcContent = mcContent       _mcMask = mcMask       _mcDragger = mcDragger       _mcTrack = mcTrack          moveSpeed = 2;     easingSpeed = 5;     scrollHeight = _mcTrack.height ;              // how much of the movie can be scrolled     scrollable = Math.round(_mcContent.mcRegister.height - mcMask.height);     initContentPos = 12          // the drag positions that are possible for the mcDragger     left = _mcTrack.x;     top = _mcTrack.y + 26;     right = _mcTrack.x;     bottom = _mcTrack.height - _mcDragger.height + _mcTrack.y     scrollWheelSpeed = 30;              dragBounds = new Rectangle(_mcDragger.x, _mcDragger.y, 0, _mcTrack.height - _mcDragger.height);          initHorizontal();   }        private function initHorizontal():void     {         // before we do anything make sure the content is even scrollable, if it isn't hide everything and return         if (scrollable<0)         {             _mcDragger.visible = false;             _mcTrack.visible = false             //btnDown.enabled = false;             return;                          _mcContent.removeEventListener(Event.ENTER_FRAME, updateContentPos);         }           else         {             addListeners();         }     }        private function addListeners():void {                          _mcDragger.addEventListener(MouseEvent.MOUSE_DOWN,   draggerDown);         _mcDragger.addEventListener(MouseEvent.MOUSE_UP, removeDraggerEvents);     }        private function draggerDown (me:MouseEvent):void {                          _mcDragger.startDrag(false, dragBounds);                 _mcDragger.addEventListener(MouseEvent.MOUSE_MOVE,   draggerMouseMove);         //_mcContent.addEventListener(Event.ENTER_FRAME, updateContentPos);     }          private function draggerMouseMove (me:MouseEvent):void {         updateContentPos();     }          private function removeDraggerEvents (me:MouseEvent):void {         _mcContent.removeEventListener(Event.ENTER_FRAME, updateContentPos);         _mcDragger.removeEventListener(MouseEvent.MOUSE_MO  VE, draggerMouseMove);         _mcDragger.stopDrag();     }          private function updateContentPos ():void     {         percentScrolled = (_mcDragger.y-top)/(scrollHeight-_mcDragger.height);                 // instead of setting the _y property directly, we simple set newY         // that way we can adjust how we handle the new Y coordinate we'd like to move to         newY = Math.round(initContentPos-(percentScrolled*scrollable));                 trace(percentScrolled)                           _mcContent.y += Math.round((newY-_mcContent.y)/easingSpeed);     } }

i have a code inside my total movie which contains the scroller, the code is:

ActionScript Code:
var myContentScroller:ContentScroller2 = new ContentScroller2(mcContent, mcMask, mcDragger, mcTrack, 3, false)


All the clips like: mcContent, mcMask, mcDragger, mcTrack are on the stage.
To use this MC's well i have to (or maybe not) i have to "re-assign" them in the package like (maybe there is a cleaner and better way?):

ActionScript Code:
_mcContent = mcContent _mcMask = mcMask _mcDragger = mcDragger _mcTrack = mcTrack


but now my final question is how can i target the movieClip "mcRegister" which is inside "mcContent" on the stage? (in AS1 it was like mcContent.mcRegister but that wont work.)
the code in the package is like:

ActionScript Code:
scrollable = Math.round(_mcContent.mcRegister.height - mcMask.height);


Hope somebody can help me out!

Greetz!

Load Movieclip Into A Movieclip On Stage
On the loading of my page, I need to load an english text movieclip into one that's on stage. Also on stage is a button to push for the Japanese translation. When this button is pushed, I need to load the japanese movieclip into the place where the english version is and for the english to go away. How do I do this?

Movieclip Referencing Another MovieClip On Stage
Hi all,
I have a movieclip with dynamically loaded content in a movieclip that sits on the stage, which works fine, it loads the content fine. Call it Clip A
I want multiple movieclips to reference this movieclips content. ie I want a copy of this Clip A to appear in multiple movieclips.

Real example
Clip A loads teamshirt Arsenal
Multiple clips to also have Arsenal teamshirt by looking at ClipA

Any ideas? Do i go about it using loadMovie and pointing it to the scene or attachMovie?

thank you in advance
Jason

Accessing A MovieClip On The Stage From Within Another MovieClip
Hi, after many hours searching through many forums and posts im still not finding the answer to what should be pretty simple to achive. If anyone has an idea please do tell me.

Problem is this:-

I have two movieClip's on a stage (on the main timeline). Called 'box4_mc' and 'fadeSquare_mc'. Inside 'box4_mc' on its timeline (but only on frame 54) is a button called 'close4_btn'. When I click on 'close4_btn' I want 'fadeSquare_mc.play();' to work. The actionscript code has to go on the 'box4_mc' timeline because the button doesn't exist to the main timelime. I have attached a .fla file zipped up as an example. I have tried the following:


Code:

this.parent.fadeSquare_mc.play();
and also

Code:

this.fadeSquare_mc.play();
the first gives an error 1119: Access of possibly undefined property fadeSquare_mc through a reference with static type flash.displayDisplayObjectContainer.

the 2nd gives
TypeError: Error #1010: A term is undefined and has no properties.
at boxes4a_fla::box4_12/closeBox4()

im at a loss what to do.

Thanks in advance.

F8 Movieclip Change On Stage Causes The Entire Stage To Dissapear
I have my stage with a background picture.

On stage left are buttons, and on stage right I have a movieclip (mc_Preview).

When the user puts his mouse over each button I would like the movieclip to move to a different frame.

the problem is when the mouse moves over a button, i see the movieclip move but then the entire stage dissappears and turns a few shades of gray.

Does this sound familiar to anyone?
Any help would be greatly appreciated!

(MX)movieclip Visibility When Loading Movieclip
Hello!

I'm having a little problem when I use this code:

mymovieclip1._visible=false
mymovieclip1.loadmovie("xxx.swf")

The problem is that he does load the movie, but that he doesn't make it invisible. And I only want the movie to be visible a few seconds later...
What is wrong here?

THanks!

Loading A Swf Into A Movieclip Inside Another Movieclip
Hi, i am having a main.swf which has a movieclip in the form of a window. it's instance name is window_mc. this window has an empty movieclip called load_mc and i am trying to load another swf called login.swf into window_mc.load_mc using

window_mc.load_mc.loadMovie("login.swf");

both main and login swfs are having resolution 1000x780.. but wen it is loaded as said above, the texts inside the loaded swf looks very large. the resolution looks as if they are different.. please help me on this... i haven't tried loading movieclips much. but wen i load a swf into an empty movieclip, it wrks perfectly fine...

Loading External Movieclip From An External Movieclip Library Into Main Movie?
How do you load an external movieclip from an external movieclip library into a main movie?

I have an external movieclip loaded within a main movie. I then want the external movieclip to be able to take a movieclip from its own library and the load this into another container ind the main movie.

In other words:

A contains B

B contains C

I want a button in B to place C directly in A

How is this done?

Put Movieclip On Stage
this sounds stupid but i've always put stuff on the stage by having it just outside the visible screen and duplicating it onto the stage.


here's my problem:

I've got an instance of a MC off the stage. It's got some code which makes it move etc... if i duplicate it all the duplicates move fine. problem is the original moves as well. and goes flying off to infinity. i haven't put any boundary conditions in because they would remove the original MC an i wont be able to duplicate any more.


i would ideally like to duplicate the MC from the library. But that would mean putting the code to move everything in the main timeline or another MC which i'm trying to avoid.


----------------------
THE BOTTOM LINE

i need to duplicate the MC from the library which contains all the relevant code to move itself.
----------------------

any help/advice is good.
thanks.

_y Value In Movieclip Vs _y Value On Stage
When you refer to the _y value of a movieclip that is within another movieclip, does it refer to the _y position of the clip within the parentclip, or the _y postion of the clip in relation to the mainstage?

For example:

_root.bigbug.splat_y

splat's _y value within bigbug is at 0, but bigbug's _y value on the mainstage is 20.

Does this make _root.bigbug.splat_y=0 or _root.bigbug.splat_y=20

If you changed things to _parent.splat._y, would it change things as well?

Trying To Add A MovieClip To Stage...
I need some help cause i don't know why my movieclip doesn't appear on the stage. Here is the thing:

-> i create a class that's adding a movie clip to the stage ...and i only use this movieclip for once...when the user clicks on it it dissapears and then i instantiate another class and i try to add another MovieClip to the stage. .Here is the code for the second addChild:

package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.display.SimpleButton;


public class AlignMenu extends MovieClip
{
private var menu2:MenuR = new MenuR();

public function AlignMenu():void
{
trace("hello");

menu2.x = 100;
menu2.y = 105;
this.addChild(menu2);
trace(menu2);


menu2.btn1_resized.addEventListener(MouseEvent.CLI CK, onClick1);
menu2.btn2_resized.addEventListener(MouseEvent.CLI CK, onClick1);
menu2.btn3_resized.addEventListener(MouseEvent.CLI CK, onClick1);
menu2.btn4_resized.addEventListener(MouseEvent.CLI CK, onClick1);
menu2.btn5_resized.addEventListener(MouseEvent.CLI CK, onClick1);
menu2.btn6_resized.addEventListener(MouseEvent.CLI CK, onClick1);

}

private function onClick1(event:MouseEvent):void
{
trace("hello");
}
}
}


the problem is that i don't see the menu on the stage. I put a trace to see if the object is created and it is ... in the output window it shows me
----
hello
[object MenuR]

Somebody can give me a hint why can't i see the MovieClip on the stage ?

Add MovieClip To Stage
I'm something of a noob when it comes to ActionScript.

Previously worked with C# so I've got some of the basics when it comes to OOP but I'm struggling with the following problem:

I have a symbol in my library (as a Movie Clip) linked to a class called Cat.

In the constructor of the Cat class I set a few simple properties with statements like

this.x = 50;
this.alpha = 0.5;

That all works fine.

In my .fla file, in frame 1, in the Actions window I have the following code:

var myCat:Cat = new Cat();
addChild(myCat);

And again, that all works fine. When I test the movie I get a single instance of a Cat, exactly where I'm expecting it.


Question: How can I get the constructor of the Cat class to add each new instance of Cat to the stage (so that I can remove the 'addChild(myCat)' from the Actions window code?

I've tried each of the following within the constructor but neither of them work:

addChild(this);
stage.addChild(this);

If anybody can help me, I'd really appreciate your assistance.

Thanks for reading this.

DD

Is My Movieclip On The Stage?
Is there a method that will tell me if my movieclip is on the stage?

something like:


ActionScript Code:
if( MY MOVECLIP IS ON THE STAGE){
myMovieClip.x = 0;
}
else{
addChild(myMovieClip);
}

Thanks for the help!

Movieclip On Stage Does Not Appear
Flash MX
Actionscript 1.0

I have a movieclip (portfolioSubMenu) that contains other clips that are set up by a script in the first frame,to act as buttons. One of them (buttonLogos_
instructs the movieclip "portfolioSubMenu" to go to frame "logos" and play.

It does this - I have a trace set up so I know the timeline is sitting on that frame. On the portfolioSubMenu timeline I can see the clip (controllerLogos) that should be appearing but when I run the movie it's not visible.

I checked to make sure that the clip wasn't set to _visible == false and it's not.

The timeline is sitting on the right frame but the items on the stage are not visible

fla is attached


What gives?

I just tried adding a new layer and put a simple shape on it. That doesn't appear either so the issue is not with the embedded movie clip.

Movieclip At Stage
I am just now starting to use AS3. This script attached is located in a MovieClip on the stage. There are 12 movieclips on the stage that have visible set to false (a1 - a12). I am not able to set them to true. I am getting the error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Window1/Act13()










Attach Code

function Act13(event:MouseEvent):void
{
for(var i=1;i<13;i++)
{
MovieClip(root)["a" + i].visible = true;//does not work
}
parent.removeChild(this);//works
}
w2.addEventListener(MouseEvent.CLICK, Act13);

























Edited: 03/26/2008 at 12:56:05 PM by jtspears3450

Movieclip Out Of The Stage
Hi,

How can I make an movieclip leave the stage throw an event on a buttom? What action shoud I give to the buttom??

Thanks
Jefferson

If anyone could leave me an example It would be very helpfull!!!

Movieclip Out Of The Stage
Hi,

How can I make an movieclip leave the stage throw an event on a buttom? What action shoud I give to the buttom??

Thanks
Jefferson

If anyone could leave me an example It would be very helpfull!!!

Constrain A Movieclip To The Stage
I have made a movie clip in my movie that is draggable. It can also be minimized and maximized (using yscale). The problem is, when it's published, the movie clip can be dragged almost completely out of view. I'm no expert, but there must be a way to prevent this. Any ideas?

Moving A Movieclip Across The Stage
The script below moves a movie clip from the bottom to the top of the screen:

onClipEvent(load) {
// these values are initialised when this movieclip first loads
//maxY is the position at which we want to reset the _y position of the movieclip
maxY = 0;
//startY is set to the initial position of the movieclip
startY = this._y;
}

//the following script runs all the time (Ie: every frame even if the movie is stopped)
onClipEvent(enterframe) {


if (this._y >= maxY) {
// if the Y position of the movieclip is greater than the maximum required position
// then we move the movieclip by adding the value of 'speed' divided by our constant
// (we need to divide by a constant otherwise it will be too fast!
this._y -= _root.speed/_root.constant;
} else {
// when the movieclip reaches the max desired position we reset the Y pos to the initial value
this._y = startY;
}
}

I would like to move this movie clip from the bottom right corner to the left, then from the bottom to the top, and finally from the top left to the right corner all in one continous movement.
Can anybody help me please?

Pop Up Random Movieclip On Stage
Im currently making a kind of flashmovie for a youth festival next year.
The problem is that it is a bit boring (http://www.teejay.no/lab/ferdig.html) (Yes it is in Norwegian, click "Ja" to enter the movie!)
To make it a bit more interesting and fun for the viewers, I came up with the idea of making lots of movieclips, each containing a person's "profile", where you can read about a person, and choose wheter to read more, or ignore this person. These movieclips should pop up on the stage once every minute or so, and randomly.
Does anyone have any suggestion on how I could possibly accomplish such effect?
In short; I need some kind of a script to randomly pick out a movieclip and place it in front of all other elements once every minute or so.

Appreciate all help! Excuse my English.

TeeJay

[F8] Scale Movieclip To Stage
How do you scale a movieclip that stays proportional to the stage even when the stage sizes changes?

I'm still a noob, so if you can be a little more detailed that would be awesome!

Thanks!
Jordan

Moving A Movieclip Across Stage
Ok I have tried for a month searching the internet for a script that I can adjust. What I am trying to do is build a nav bar similar to www.rbk.com.

PLEASE HELP! I can get the vertical bar to move with the mouse but I can not get it to stop at the button locations.

Here is the script I was using on the scene:
var Grn_follow = _root.Grn_follow_mc;
var speed = 15;

Grn_follow.onEnterFrame = function() {

//get the mouse position
var xMouse = _root._xmouse;


//get the distance between x
var xDistance = this._x - xMouse;


//now move the object
Grn_follow._x = this._x - (xDistance / speed);

};


And this was on the vertical bar:
onClipEvent (mouseMove) {
this._xmouse;
}

Or the other way I have it in actionscript is just thru the buttons...but I can not get the smooth transition from button to button that the above script gives me.
Ie:
on (rollOver) {
setProperty(this.Grn_follow_mc, _x, 10);
}

Am I doing something wrong? This maybe stupid easy for an expert but I am still learning. Blood sweat and tears my friends. Thanks again for any help!!!
Thanks,
Leo

PS forgot to tell you I am using flash 8.

[F8] Resize A Movieclip To Stage
Can someone point me to a tutorial that explains how to resize a movie clip to the full size of the stage? I have a presentation that plays fullscreen and I want the movie clip to play fullscreen too. Maybe theres an easier way.

Thanks!

Adding Movieclip To The Stage...
this is complete torture.

why is something which seems so easy SO difficult?

i've just made my first swf with sprites which you can throw around and they bounce off each other and are effected by gravity and drag (not the easiest thing or probably the smartest thing to start out at when teaching yourself as3) but can i get a simple movieclip to be place on the stage from the library?

can i heck.

i've created a private var menuBox1; (the name of the movieclip)

in the "private function init():void {" of my document class i've got the following:
code: menuBox1 = new menuBox1();
this.addChild(menuBox1);
menuBox1.x = 100;
menuBox1.y = 100;

the class name in the linkage panel of the movieclip is menuBox1, but this script keeps coming back with the following error:

TypeError: Error #1007: Instantiation attempted on a non-constructor.
at Inquizard/::init()
at Inquizard$iinit()

now i'll put my neck out from what i've read and say the problem is probably something to do with the fact i've got my movieclip and variable both called "menuBox1" but no real idea what to do now.

can some please save this mess as right now i have real fears for the safety of my monitor...

Stage Resize Set MovieClip X And Y
Can anyone tell me what I'm doing wrong here? This seems like it should be really simple. I have a movieclip on the stage with an instance name of bg, I want this clip to resize itself based on the stage width and remain locked on the 0,0 x,y.


Code:
function setUpStage(){

var SW:Number = stage.stageWidth;
var SH:Number = stage.stageHeight;

bg.width = SW;
bg.x = 0;
bg.y = 0;

}

setUpStage();

stage.addEventListener(Event.RESIZE, myResizeHandler);
function myResizeHandler(event:Event):void {
setUpStage();
}
The width of the bg click is resizing correctly but the x and y values are not staying locked in the upper left hand corner.

Thanks in advance.

Movieclip Move Up And Down But Not Off The Stage
I have a movieclip (MC1) moving up and down on my stage but my problem is that it resets its position

Im in need of a code in which once MC1 hits 200pixels it wont reset back to 400pixels but just bounce off the limited stage and keep moving up and down in a loop within that space?

Any ideas?

Adding Movieclip To Stage
I'm having problems getting a movieclip to appear on stage. Here's what I'm doing:

function RenderTiles ():Void
{
var CurTileName:String = "";
var CurTileNum:Number = 0;

for (var yt:Number = 0; yt < TILES_PER_WORLD_SECTION_Y; yt++)
{
for (var xt:Number = 0; xt < TILES_PER_WORLD_SECTION_X; xt++)
{
TILES_ARRAY[xt][yt].TileGraphic = this.createEmptyMovieClip( CurTileName, 10);
TILES_ARRAY[xt][yt].TileGraphic.createEmptyMovieClip ( "TileGraphicContainer", 10);

var TileGraphicLoader:MovieClipLoader = new MovieClipLoader();
TileGraphicLoader.loadClip(grass.bmp, TILES_ARRAY[xt][yt].TileGraphic.TileGraphicContainer);

TILES_ARRAY[xt][yt].TileGraphic

CurTileName = "" + CurTileNum;

trace (CurTileName);

CurTileNum++;
}
}
}

The TILES_ARRAY elements have been set to my Tile class which atm only contains var TileGraphic:MovieClip;

Access Movieclip On Stage ?
I have a movieclip on stage, named "book1".

Now I have a class called "Shelf" (it's NOT a document class). Here it is :


ActionScript Code:
package{
  import flash.display.Sprite;
  import flash.display.MovieClip;

  public class Shelf extends MovieClip {
    public function Shelf {
      // .... How do I access book1 on stage ?
    }
  }
}

How do I access "book1" movieclip on stage from Shelf class ?

Thanks.

Referencing A MovieClip On Stage Through XML
Hello.

I have a swf with several MovieClip instances on the stage at authoring time. For example, say I have mBuilding that contains mFloor, that in turn contains mAppartment.

I have an xml file that contains data so the swf knows what to do with the MovieClips.


Code:
//xml
<my_data>
<movie_clip1>mBuilding</movie_clip1>
<movie_clip2>mBuilding.mFloor</movie_clip2>
</my_data>

//flash
//xmlMovies is the variable contaning xml data
trace (this[xmlMovies.movie_clip1]); //correct
trace (this[xmlMovies.movie_clip2]); //"... null object or reference..."
I've been trying different things, but I'm still stumped. Can anyone give me some advice?

Thanks in advance.

Help To Import On Stage A MovieClip
Hi !

I want to know how I can import a MovieClip who using a custom class path like (ui.ScrollBar) from my library to my stage and keep is associate class. I've try:


ActionScript Code:
var MC_ScrollBar:ui.ScrollBar = new ui.ScrollBar();
stage.addChild(MC_ScrollBar);

But I think that don't work like this, so if anybody have an idea ?

Removing MovieClip Placed On Stage
In my .fla file, I have a MovieClip (we'll call it Clip1) linked to a corresponding class defined in a separate .as file.

There's a case where I want to create a new MovieClip (Clip2) where Clip1 is, then remove Clip1. This case is dealt with by a function in Clip1's class.

So, when I get to removing I do:


ActionScript Code:
this.parent.removeChild(this)

Now, if the DocumentClass created Clip1 and placed it on the screen, this goes fine. But if Clip1 was placed on the stage in the .fla file (by dragging and dropping), it looks like Clip1 is not removed. I think it does get removed, but for some reason it gets recreated. This is the problem.

How can I stop this recreation of Clip1 while still placing it on the stage?

Thanks in advance

MovieClip Won't Show On Stage
So, I'm creating a "critter caretaker" which is basically a stripped down Tamagachi for a class. However, for some reason I can't for the life of me get the movieclip of the critter to show on stage. No matter what I do it just won't show up.

I also am not sure why, but I'm getting an error regarding my buttons.

"Implicit coercion of a value of type Class to an unrelated type flash.display:MovieClip"

Explanation of this and how to fix it would also be much appreciated

I'm attaching the files being used.

The FLA file is too big to upload, however the rest of the .as files are included. If you could take a look and let me know if you see a problem. All the movieclips are exported, etc.

Thank you!

Movieclip Loops Once When Put On Stage
Hi all,

I have a 10 frame movieclip with a stop action at the end of it. When I put it on the stage with the 10 frame space on the timeline, it will loop once ignoring the stop action within it. I have it set as a movieclip type on the timeline. How can I make it play just once? This has happened to me before, and I haven't been able to solve it.

Thanks a lot

Placing A Movieclip Onto Stage?
hi i was just wondering if anyone could tell me how i would go about placing a movie clip in the libary that has been exported for actionscript on to the stage using a class?

Thank you for any help

LoadMovie Jpg Into A Movieclip On The Stage
I am loading a jpg image from a server into a movie clip on the stage. I named the movie clip on the stage lillyimageholder1 and the action script looks like this:

loadMovie("flashPics/littleleaf.jpg","lillyimgeholder1");

This works beautifully except that when I do this, the .jpg is automatically scaled in at a size that is equivalent to the .jpg size. I would like it to simply fill the movie clip container instead of coming in at the file size equal to that of the .jpg dimensions. Basically this isn't a problem, it is more of a nuisance as I have to modify my .jpg's so that they appear properly when loaded on the page. Thanks in advance for any help.

Attaching MovieClip To Stage
Instead of attaching movie clips to the stage spacing them with a set variable how can I space them 10px more than the bottom of the last MovieClip attached?

I am creating a menu and some of the text in the menu items has to wrap which increases the height of the menu so I need the next menu item to space evenly and not on top of the next one. I also can't increase the set variable because the rest of the menu items will not visually look correct. Too much spacing.

Here is my code:








Attach Code

var tfrmt:TextFormat = new TextFormat();


function bNav():Void{

for(i = 0; i< mainNav.length; i++){
var c = mainNav[i].btn;

if( c == 1){

mbtn = this.mNav.attachMovie("btn1","navBtn" + i, i);

} else {

mbtn = this.mNav.attachMovie("btn2","navBtn" + i, i);

}

mbtn._x = 0;
mbtn._y = (24 * i);
mbtn.id = i;

mbtn.btnTitle.text = mainNav[i].title;
mbtn.url = mainNav[i].url;


mbtn.onRollOver = function(){
tfrmt.underline = true;
this.btnTitle.setTextFormat(tfrmt);

//this.gotoAndStop("over");


}

mbtn.onRollOut = function(){
tfrmt.underline = false;
this.btnTitle.setTextFormat(tfrmt);
//this.gotoAndStop("out");
}

mbtn.onRelease = function(){

getURL(this.url);

}

}

}

Access MovieClip In The Stage
Hello,

I am using the ActionScript 3 in a aplication and i have problem to access the MovieClips that is on the Stage. Let me explain.

I the stage i have two MovieClips, with instance of mc1 and mc2. Inside of mc1 i try to access some proprerties from mc2 but without success.

I try using this:

trace(parent.mc2.width);

But the Flash return the error 1119, undefined propertie.

So, how can i access the MovieClips that is on my stage from another MovieClip.

Thanks

Finding Out If Any Movieclip Are On The Stage?
Hello everyone,

I would appreciate it if someone can help me out with this. I would like to write a function that would return the names of the all the movieclips that are on the stage. I have written an function but it only return true or false whereas I would like the function to return the name(s).










Attach Code

function checkClip()
{
var j:Boolean;
j = typeof(movieclip) ? true : false;
trace(j);
}

checkClip();

Referencing A MovieClip On Stage Through XML
Hello.

I have a swf with several MovieClip instances on the stage at authoring time. For example, say I have mBuilding that contains mFloor, that in turn contains mAppartment.

I have an xml file that contains data so the swf knows what to do with the MovieClips.

I've been trying different things, but I'm still stumped. Can anyone give me some advice?

Thanks in advance.







Attach Code

//xml
<my_data>
<movie_clip1>mBuilding</movie_clip1>
<movie_clip2>mBuilding.mFloor</movie_clip2>
</my_data>

//flash
//xmlMovies is the variable contaning xml data
trace (this[xmlMovies.movie_clip1]); //correct
trace (this[xmlMovies.movie_clip2]); //"... null object or reference..."

Copyright © 2005-08 www.BigResource.com, All rights reserved