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




Not Relaoding Child Movie



How do I get a child movie to not reload in the parent evertime a link progresses the parent movie?



FlashKit > Flash Help > Flash MX
Posted on: 02-18-2003, 03:25 PM


View Complete Forum Thread with Replies

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

Relaoding Loaded .swf's
I have 5 external .swfs being loaded into 5 empty MC's in my main movie.

They are loaded with a loadMovie command to a target, not a level.

Problem is this - when I go back to revisit one that has already been loaded, it loads again

I don't know why.

Should I do some kind if if/else thing where it checks to seif it already is loadedso that it doesn't ask to reload?

Tx

XML Relaoding Problem
I have a flash which interacts with database using XML. The flash calls a server side script file which reads the data from database and then dumps into a XML file which is read by flash for displaying the data. In the first frame the flash calls the ASP file using loadVariables which reads the database and writes the XML file. I have a delete button which calls an external file again thru loadVariables, which deletes the selected record from database, and then goes back to first frame which in turn reads the new data from the database and writes it to the XML.

The problem is flash doesnot loads the new data and it keeps on showing the old data. The new data appears only when you open the flash in a new IE window. Any thoughts on this and how the XML can be cleared and reloaded so that it shows the fresh data.

Also, please point some good intermediate/advance tutorials on Flash and Database interaction.

thanks in advance

Why Wont Text In Child Movie Scroll When Loaded In Parent Movie
why doesnt the text scroll when the news movie is loaded into the main movie. ive attached all files this time.

Deleting Child Movie Clips In Parent Movie Clip
ok so I when I click the bt1 I want it to make the home_text visible and remove all of the movie clips within the CreateXMLGallery function. But when I do gallery.removeMovieClip() it only deletes the gallery and none of the other movie clips that are created within the gallery. Any ideas why? here is the code.


HTML Code:
stop();
/***********Button Functions*************/
launch_mc._visible = false;
easeSpeed = 5;
slider_mc.onEnterFrame = function() {
this._x += (xMove1-this._x)/easeSpeed;
};
bt1.onRollOver = function() {
bt1.blendMode = "invert";
};
bt1.onRollOut = function() {
bt1.blendMode = "normal";
};
bt1.onPress = function() {
xMove = bt1._x;
};
bt1.onRelease = function() {
gallery.removeMovieClip();
home_txt._visible = true;
};
bt2.onRollOver = function() {
bt2.blendMode = "invert";
};
bt2.onRollOut = function() {
bt2.blendMode = "normal";
};
bt2.onPress = function() {
xMove = bt2._x;
};
bt2.onRelease = function() {
gallery.removeMovieClip();
home_txt._visible = false;
createXMLGallery(webXML);
};
bt3.onRollOver = function() {
bt3.blendMode = "invert";
};
bt3.onRollOut = function() {
bt3.blendMode = "normal";
};
bt3.onPress = function() {
xMove = bt3._x;
};
bt3.onRelease = function() {
gallery.removeMovieClip();
home_txt._visible = false;
createXMLGallery(interactiveXML);
};
bt4.onRollOver = function() {
bt4.blendMode = "invert";
};
bt4.onRollOut = function() {
bt4.blendMode = "normal";
};
bt4.onPress = function() {
xMove = bt4._x;
};
bt4.onRelease = function() {
gallery.removeMovieClip();
home_txt._visible = false;
createXMLGallery(avXML);
};
bt5.onRollOver = function() {
bt5.blendMode = "invert";
};
bt5.onRollOut = function() {
bt5.blendMode = "normal";
};
bt5.onPress = function() {
xMove = bt5._x;
};
bt5.onRelease = function() {
gallery.removeMovieClip();
home_txt._visible = false;
createXMLGallery(designXML);
};
/**********End Button Functions**********/
/**********Load XML files**********/
var webXML:XML = new XML();
webXML.ignoreWhite = true;
webXML.onLoad = function(success) {
if (success) {
//trace("web XML File Loaded");
}
};
webXML.load("web.xml");
var interactiveXML:XML = new XML();
interactiveXML.ignoreWhite = true;
interactiveXML.onLoad = function(success) {
if (success) {
//trace("interactive XML File Loaded");
}
};
interactiveXML.load("interactive.xml");
var avXML:XML = new XML();
avXML.ignoreWhite = true;
avXML.onLoad = function(success) {
if (success) {
//trace("audio video XML File Loaded");
}
};
avXML.load("audiovideo.xml");
var designXML:XML = new XML();
designXML.ignoreWhite = true;
designXML.onLoad = function(success) {
if (success) {
//trace("audio video XML File Loaded");
}
};
designXML.load("design.xml");
/**********XML files loaded**********/
/**********Create the Gallery*******/
function createXMLGallery(whichXML) {
var gallery:MovieClip = createEmptyMovieClip("gallery", getNextHighestDepth());
gallery._x = 70;
gallery._y = 170;
var numImages = whichXML.firstChild.childNodes.length;
var spacing:Number = 60;
var columns:Number = 3;
for (var i:Number = 0; i<numImages; i++) {
this.proj_name = whichXML.firstChild.childNodes[i].firstChild.firstChild.nodeValue;
this.proj_type = whichXML.firstChild.childNodes[i].firstChild.nextSibling.firstChild.nodeValue;
this.thumbHolder = whichXML.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.firstChild.nodeValue;
this.picHolder = whichXML.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.nextSibling.firstChild.nodeValue;
this.proj_media = whichXML.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.nodeValue;
this.description = whichXML.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.nodeValue;
this.proj_link = whichXML.firstChild.childNodes[i].firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.firstChild.nodeValue;
this.thumbViewer = gallery.createEmptyMovieClip("thumb"+i, i);
this.thumbViewer._x = (i%columns)*spacing;
this.thumbViewer._y = Math.floor(i/columns)*spacing;
this.thumbLoader = this.thumbViewer.createEmptyMovieClip("thumbnail_image", getNextHighestDepth());
this.thumbViewer.description = this.description;
this.thumbViewer.picHolder = this.picHolder;
this.thumbViewer.proj_link = this.proj_link;
this.thumbViewer.proj_name = this.proj_name;
this.thumbViewer.proj_type = this.proj_type;
this.thumbViewer.proj_media = this.proj_media;
this.thumbViewer.whichXML = whichXML;
this.thumbLoader.loadMovie(this.thumbHolder);
this.thumbViewer.onRollOver = function() {
var proj_name = this.proj_name;
captionFN(true, proj_name, this);
this.onRollOut = function() {
captionFN(false);
};
};
this.thumbViewer.onRelease = function() {
launch_mc._visible = true;
var url = this.proj_link;
var type = this.proj_type;
var media = this.proj_media;
launch_mc.onRelease = function() {
if (type == "Website") {
getURL(url);
} else if (type == "Interactive") {
trace(url);
fscommand("exec", url);
} else if (type == "Design") {
var shade:MovieClip = createEmptyMovieClip("shade", getNextHighestDepth());
with (shade) {
beginFill(0xFFFFFF, 75);
moveTo(0, 0);
lineTo(Stage.width, 0);
lineTo(Stage.width, Stage.height);
lineTo(0, Stage.height);
lineTo(0, 0);
}
shade.useHandCursor = false;
shade.onRelease = function() {
trace("OUCH");
};
shade.onPress = function() {
trace("OUCH");
};
var imageViewer:MovieClip = attachMovie("imageviewer", "imageView", getNextHighestDepth());
imageView._x = Stage.width/2-imageViewer._width/2-10;
imageView._y = Stage.height/2-imageViewer._height/2;
var closeMovie:MovieClip = attachMovie("close", "closeMov", getNextHighestDepth());
closeMovie._x = 568;
closeMovie._y = 75;
closeMovie._width = 48;
closeMovie._height = 19;
closeMovie.onRollOver = function() {
this._alpha = 50;
};
closeMovie.onRollOut = function() {
this._alpha = 100;
};
closeMovie.onRelease = function() {
imageView.removeMovieClip();
closeMovie.removeMovieClip();
shade.removeMovieClip();
thumb.removeMovieClip();
};
var thumb:MovieClip = createEmptyMovieClip("thumb", getNextHighestDepth());
thumb.attachMovie(url, "urlofmovie", getNextHighestDepth());
thumb._x = Stage.width/2-thumb._width/2-10;
thumb._y = Stage.height/2-thumb._height/2;
} else if (type == "Video") {
fscommand("exec", url);
}
};
var thumbInfo:MovieClip = createEmptyMovieClip("thumbinfo", getNextHighestDepth());
//Description field attributes
createTextField("desc", getNextHighestDepth(), 555, 170, 200, 300);
desc.border = false;
desc.multiline = true;
desc.wordWrap = true;
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Verdana";
my_fmt.size = 12;
my_fmt.align = "justify";
desc.text = this.description+"
Media: "+media;
desc.selectable = false;
desc.textColor = 0xffffff;
desc.setTextFormat(my_fmt);
//End description field attributes
thumbInfo.loadMovie(this.picHolder);
thumbInfo._x = 315;
thumbInfo._y = 200;
};
}
}
/**************End Gallery*******************/

Dynamically Duplication Movie And Its Child Movie Clips
Hi all,

I have a movie clip in my library. This movie clip contains other movie clip also.

Now I want to bring this movie clip to the stage. I have used attachmovie method to do this. Whatever the new name, I have assigned to the movie clip in the AttachMovie method works well. But the movie clips inside that movie clip doesn't have the name.

How to name the movie clip and all its child movie clip.

Thanx

Nag

Loading A Grandchild Movie Into A Child Movie From Parent
hello - Can I load a grandchild movie from the parent? Here is what I have: I have a main move, a child movie and a "grand child" movie.

I want to click a button on the parent ( which is my root) and load the child into a container on the main, then automatically load the grandchild into a container in the child movie. I dont want any scripting in the child movie though. I want the entire thing to be handled from the main root movie.

Can I do this an how? Ive tried:

var mcl:MovieClipLoader = new MovieClipLoader();
mcl.loadClip("child.swf",childHolder);// childHolder is a container in the main.swf
mcl.loadClip("grandchildMovie.swf",grandchildHolde r);//grandchildHolder is a container in the child.swf.

Any advice would be greatly appreciated.

Im running flash 9 from cs3 web bundle.

Accessibility Tabbing From Parent Movie Into Child Movie
Using JAWs, I can tab around in either parent or child movie, but can't get the tab to move from parent movie into child movie.
After tabbing to instance's tab 3 in parent movie, I can't get the tab key to go to instance's tab 4 in child movie. Accessibility panel check boxes for both movies are all checked and the appropriate actionscripting is in the first frame of both movies.
Any ideas???? Thanks.

Oop Question: A Simple Way To Access Methods In Child Classes From Other Child Class
hi All, I have another oop question.

I'd like to call a method in a child class from another child class.
I'd like to do it without instantiating the other child class...
an example will be easier to see what I mean

document class

ActionScript Code:
package
{
    import flash.display.*
    public class Tester extends MovieClip
    {
        var ch1:Child1;
        var ch2:Child2;
       
        function Tester()
        {
            ch1 = new Child1();
            ch2 = new Child2();
        }
    }
}
child 1

ActionScript Code:
package
{
    class Child1 extends MovieClip
    {
        function Child1()
        {
            trace("Child1 is working");
        }
       
        public function hello()
        {
            trace("Child1 Hello function")
        }
    }
}
child 2

ActionScript Code:
package
{   import flash.display.*
    class Child2 extends MovieClip
    {
        function Child2()
        {
            trace("Child2 is working");
           
            //Tester.ch1.hello();
        }
    }
}

the commented line in Child2 is what I'm asking about. is there any way to do this without defining the Tester class in Child2?

... I mean, without saying : var tstr:Tester = new Tester(); in Child2... and then calling the function via tstr.hello();

thank in advance guys..

Stop FLV Playback In Child When Removing Child (or At Least Silence Audio)
I'm working on a flash site with a number of different "states" (home, features, demo, etc.) each of which is a movie clip with its own actionscript, added as a child when requested, removed when the user chooses a new state.

One of the states plays short FLV videos. The problem is, when switching away from that state to a different state, even though the child is removed, the current video apparently keeps playing as I can hear the audio continuing on.

To demonstrate, the site is here. Click on "Demo", then play one of the videos and switch to a different state (home, features, whatever) while the video plays.

I'm trying to call a function in the child to stop video playback (first checking whether the function exists before trying to call it). The checking part works, but the function call is giving me a "call to possibly undefined method" error when publishing. Probably because I'm calling it the wrong way.

Here's the "remove child" code used after switching to a new state:


Code:
var child:DisplayObject;

while(stateContainer.numChildren > 1)
{
child = stateContainer.getChildAt(0);
if ('stopPlayback' in child)
{
trace('exists');
child.stopPlayback();
}
else
{
trace('does not exist');
}

stateContainer.removeChildAt(0);
}
Can you tell me a better way to do this? I find it strange that it traces "exists" when the function exists, but still complains that child.stopPlayback() (might not) exist.

Variables Of A Child Not Visible To A Function In The Child Called From Its Parent ?
sorry, this is a repeat thread, but couldn't change the title on the old one, someone must know the solution to this problem, I just dont think i worded it correctly enough for someone who knew what i was talking about to notice last time.

Ive got a movieclip that creates and adds a child mc then calls a function in the new mc. the function runs, but the local vars for the new mc aren't visible to the function. Is there a special way to call a function so that its scope is in the child, not in the parent ? ( i assume thats where it is, even though a trace of this returns the correct object type )

ie:

[Parent Clip]
--[child clip: movGraph]
--variable ( var thegraph:MovieClip = this; )
--[function loadMe]
--(trace (theGraph); )

calling movGraph.loadMe spits out undefined or null object error, as opposed to
[object movGraph]

obviously i want to do a whole lot more than trace out the object type, and trace(this) in the function returns [object movGraph]. the variable "theGraph" declared in the child isn't available or its null somehow.

Can anyone tell me where I'm going wrong ? - any help would be appreciated. at the moment I'm having to add all the code in the function instead of the "root" of the child. which really defeats the point.

Child Movie Control Parent Movie
My colleague is trying to work this out.

He has a main movie that calls a swf into itself. In essence it calls a menu into itself. This menu needs to control the parent movie. Can this be done?

Steven.

Fade From Child Movie To Parent Movie
Ok.. so - I have a parent movie which has loaded a second movie at level 1. Is there a simple way to have the following occur:
- hit a 'home' button within the second movie so that it plays around 20 frames to the end of it's timeline WHILE it goes to and plays from a specified frame in the parent movie?

What I'm after is a transitional fade from the child movie back to the parent; a sort of fade down of the child and fade up of the parent. At the end of the child fade it will unload itself.

Any suggestions? I need a quick solution!

Many thanks!
tonto

Moving A Duplicated Movie To A Child Movie
There must be a simple solution to this but I really can't find it. I'm loading an external SWF 'X' into movie clip 'A'. Then within movie 'C' inside movie 'B' inside movie 'A' I need to create 30 copies of movie 'X'. If i try to copy 'X' using duplicateMovieClip within 'C', the copies of 'X' sit inside 'A' and not 'C' where I need them. Can I movie the copies into 'C'? Can I create them in 'C' in the first place? Or do I need to use AttachMovie but if so, how do I LINK my dynamically loaded movie? Thanks

How To Replay A Movie From A Child Movie In Flash 5?
Hi

I'm using Flash 5 and I have a movie inside a movie where the replay button is placed. In the on release event I don't know what code to use. I've tried the following but it didn't work:

gotoAndPlay (1);
gotoAndPlay ("Scene 1", 1);
_root.gotoAndPlay (1);
_parent.gotoAndPlay (1);

And other variations of this, but nothing seems to do the job.

Could someone help with this please.

Thanks

Access Parent Movie From Child Movie
Hi,
Is it possible to access the Parent movie from a movie that is loaded within it?
Say i want a button in the child movie that goes to a certain frame in the parent movie?
Thanks guys..

Linking From Child Movie To Parent Movie
Hey there,

So, I have a little movie where I am trying to link from a child movie clip that is being loaded into a parent movie click. The way this is configured is that I have the parent movie clip, I choose a page and the page is being loaded into the loader. Now once the child movie loaded in the loader the navbar is no longer in the parent movie but in the child movie and I want to know how to control the parent movie with the child movie navbar. I want to send the parent movie to a different frame in the movie to either load the home page content or to load a different page...

I have been using this.

In my child movie i have 2 links and one transition so I am sending a variable and the variable should be loaded on the last frame of the transition:


Code:

Links:
on(release){
page = "bag";
gotoAndPlay("close");
}

Last frame:
MovieClip(parent).gotoAndPlay(page);

also tried
_root.gotoAndPlay(page);



and that is not working, now i am really really new at ActionScript and just dont get why it isnt working...

Help guys please,

Nick

RemoveChild? I Want To Remove The Previous Child Before Adding A New Child
I tinkered with AS3 a few months back, but don't have ANY of the old scripts and can't remember much.

I'm calling a method to add a new MovieClip to the Stage from the library, I've got that setup and working but each new instance overlay's the old one and doesn't replace.

I clearly need to removeMovieClip() but that is an AS2 function not AS3?

removeChild returns an error:

**
TypeError: Error #2007: Parameter child must be non-null.
at flash.display:isplayObjectContainer/removeChild()
at LukeSturgeon/loadPage()
at LukeSturgeon/navButtonHandler()
**

my two key functions are:

**
/**
* loadPage method
*/
public function loadPage(page_str:String):void {
removeChild(page)
var page:MovieClip = getPage(page_str);
///
page.x = padding_left;
page.y = padding_top;
this.addChild(page);
}
/**
* getPage method
*/
private function getPage(page_str):MovieClip {
var new_page:MovieClip;
///
switch (page_str) {
case "Profile" :
new_page = new Profile();
break;
case "Contact" :
new_page = new Contact();
break;
default :
new_page = new Work();
}
return new_page;
}

this version (minus the removeChild line) is viewable at http://www.lukesturgeon.co.uk/as3

any thoughts? it's probably so simple!!!

Child Movie Clips
Ok...I have a couple buttons that I want to load movie clips say box1.mc and box2.mc. How would I have "button 1" load box1.mc and when you click on "button 2" it would load box2.mc and have box 1.mc fade out and visa versa? I'm a newbie when it comes to this stuff, so details would be nice Thanks in advanced.

Unloading A Child Movie
Hi all,

The first movie is "Home.swf" and I loaded another movie called "childOne.swf" in to the home.swf by this command _root.holder.loadMovie("childOne.swf");, it works fine.

But i need to remove the "childOne.swf" , when clicked on that ... How ?

i tried with this "removeMovieClip("childOne.swf") But its giving error..

Plz help me ..

Code Problem: Getting A Child Of A Child Using GetChildAt()
Hi Guys,

Need a bit of help here! I'll explain what my set up is first:

In my game, I have a number of level icons set up on the stage (movieclips), each with a padlock symbol on it (a child movieclip). All level icons are placed in a container movieclip call 'container'.

Here's what I'm trying to do:

hide the padlocks on selected level icons from within my code.

To do this, I'm cycling through the children of the container movieclip to get at each level icon as follows:


Code:
for (var n=0; n<container.numChildren; n++) {
var displayItem:DisplayObject = container.getChildAt(n);
//etc.
}


That bit works nicely - I can get at each of the level icons which is now called 'displayItem'.

But now, I want to get at the child of 'displayItem' (ie the padlock, so I can hide it. I was thinking:


Code:
var child:DisplayObject = displayItem.getchildAt(0);


would do it, but I get a 'call to undefined method getChildAt through a reference with static type' error.

This seems to be telling me that 'displayItem' doesn't have that particular method associated with it.

With that attempt failed, I tried instead adding the padlocks to the level icons from within the code:


Code:
for (var n=0; n<container.numChildren; n++) {
var displayItem:DisplayObject = container.getChildAt(n);

var padlock:padlock_mc = new padlock_mc();
container.displayItem.addChild(padlock);
}


.... but that gives the same error. There's something about the display item retrieved from getChildAt that won't let me get at it's methods/properties.

I then tried converting the type from DisplayObejct to MovieClip:


Code:
container.(displayItem as MovieClip).addChild(padlock);


but that threw a 'filter operator not supported' error.


Any ideas how I should be going about this?

Cheers.

Remove Child After Adding Child Issue
OK so here goes. I was helped extremely before on my problem but while testing and checking output window I get the following error:

TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/removeChild()
at final2fla_fla::MainTimeline/reportDownCdRomClick()

This only happens when I click on the reportDownCdRomClick button (button2) not on the other. This is what I am working with:












Attach Code

//variables for buttons
var myLeftRequest:URLRequest;
var myRightRequest:URLRequest;
var myLeftLoader:Loader;
var myRightLoader:Loader;
var myCdRomRequest:URLRequest;
var myCdRomLoader:Loader;


//Web Button Listeners
webwork_mc.addEventListener(MouseEvent.CLICK,reportDownWebClick);
cdrom_mc.addEventListener(MouseEvent.CLICK, reportDownCdRomClick);
//photo_mc.addEventListener(MouseEvent.MOUSE_DOWN, reportDownPhotoClick);
//design_mc.addEventListener(MouseEvent.MOUSE_DOWN, reportDownDesignClick);

//Function for web button

//button one
function reportDownWebClick(myevent:MouseEvent):void {
myLeftRequest = new URLRequest("left-content.swf");
myRightRequest = new URLRequest("right-content.swf");
myLeftLoader= new Loader();
myRightLoader = new Loader();
myLeftLoader.x=70;
myLeftLoader.y=168;
myRightLoader.x=460;
myRightLoader.y=168;
myLeftLoader.load(myLeftRequest);
myRightLoader.load(myRightRequest);
addChild(myLeftLoader);
addChild(myRightLoader);
removeChild(myCdRomLoader);
webwork_mc.removeEventListener(MouseEvent.CLICK, reportDownWebClick);
cdrom_mc.addEventListener(MouseEvent.CLICK,reportDownCdRomClick);
}

//button two

function reportDownCdRomClick(myevent:MouseEvent):void {
myCdRomRequest = new URLRequest("XML2.swf");
myCdRomLoader = new Loader();
myCdRomLoader.load(myCdRomRequest);
myCdRomLoader.y = 140;
addChild(myCdRomLoader);
removeChild(myLeftLoader);
removeChild(myRightLoader);
webwork_mc.addEventListener(MouseEvent.CLICK,reportDownWebClick);
cdrom_mc.removeEventListener(MouseEvent.CLICK, reportDownCdRomClick);
}

Child Swf Load New Child Swf Inot Parent Swf
ok you're all going to think i'm super dense

but i'm also super stressed and fast approaching a deadline

can someone please tell me the simplest way to load a child swf into a parent swf from another child swf

eg. what code do i apply to the button?

i am loading into a container.mc (blank) in the parent swf

Child Swf Load New Child Swf Inot Parent Swf
ok you're all going to think i'm super dense

but i'm also super stressed and fast approaching a deadline

can someone please tell me the simplest way to load a child swf into a parent swf from another child swf

eg. what code do i apply to the button?

i am loading into a container.mc (blank) in the parent swf

Accessing A Child Movie Clip
This code doesn't work. The movie clip instance "start" is nested in a movie clip called "bridal_navigation".

_root.start.onRollOver=function(){
black=new Color;
black.setRGB(0x000000);
}
_root.start.onRollOut=function(){
teal=new Color;
teal.setRGB(Ox33CCCC);
}

How Can I Remove All Child Movie Clips?
Hi guys.. I tried to search but the search doesnt seem to be working for me at the moment so guess i gotta make another pointless thread.

What I want to do is remove all child movies of a chosen movie. How can I do this?

thanks
-Geoff

edit: btw, i'm using Flash MX. (not 2004)

Targeting A Child Movie Clip
Hi,

i have a parent_mc and a child_mc within parent_mc.

Now the parent_mc has 10 frames and the child_mc appears only on frame 10 of parent_mc. Also there is a stop action on this frame.


The MAINTIMELINE has an actions layer and parent_mc on stage.
Now when i try to target child_mc from the maintimeline using ...



Code:
parent_mc.child_mc.onRelease=function(){
trace("hello");
}



it does NOT work. I have seen that it only works if i make child_mc appear on the FIRST frame of parent_mc and carry on to the 10th, not if its only on the 10th frame...

does any why know why this is so?

cheers

Controlling Parent Mc's From Child Movie
How can I control the property of a movie clip in the parent movie, from the child movie? I've got a parent (navigation) movie that loads separate movies into it. I want to move a clip in the parent movie when the child movie loads. I've tried all of the following in an actions layer in the child timeline with no success:

setProperty("_parent.btn_selected", _x, "325.2");
setProperty("_parent._parent.btn_selected", _x, "325.2");
setProperty("_root.btn_selected", _x, "325.2");
_root.btn_selected._x = 325.2;
_parent.btn_selected._x = 325.2;

thanks very much.

[F8] Speaking To A Child Movie Via Parent
Hello everyone ,i have a special one this time , i've been trying this for days but without a luck.

basicly what i'm having is a root swf with a movieClip in it (holderMC).

i also have anoter swf (childSWF.swf) with a movieClip (childMC)

what i need to do is to load childSWF into holderMC then telling childMC to gotoAndStop on a certain frame.

here is what i was trying :

Code:
loadMovie ("childSWF.swf","holderMC")
_root.holderMC.gotoAndStop (1);


now from multiple testing i've learned that i can put a trace function inside the childMC and so i get its location , however i cannot tell the parent swf to talk to that movieClip , i've double checked for path errors and i couldnt found none.

if anyone knows something i'm doing wrong in this simple little thing please dont be shy.

Thanks in Advance.CyberReaper

Talk To Loaded Child Movie
I am running into a problem when trying to talk to a loaded swf.

I'm loading the external movie like this:

contentHolder_mc.addChild( loader );
loader.load( new URLRequest( file ) );

When the file is fully loaded Im firing off the method below. The problem im running into is that the child movie isn't recieving my command as if there was a scope or instance name problem.

This is what I have been trying:

contentHolder_mc.nextFrame();
contentHolder_mc.loader.nextFrame();
loader.nextFrame();
contentHolder_mc.loader[file].nextFrame();
etc., nothing seems to work out.


Does anybody know how to write this method correctly?
Thanks!

Draw Objects To Child Movie? Help Please
Hi AS3 guru's, ive got a quick (hopefully) question for you. I have my main movie which includes a child movie, this child movie will move around the main movie and requires objects to be drawn within it... these objects should also move when the child movie moves. I have the code which draws the rectangles to the stage (the code runs within the child movie) but they wont move around when the child movie moves.

Here is the code which i am using:

Code:
spr_load3.graphics.beginFill(0xFFFFFF);
spr_load3.graphics.drawRect((234+loadpc),199,1,4);
spr_load3.graphics.endFill();
this.stage.addChild(spr_load3);


Is there a way to add the children directly to the child movies stage? That way it would take into account the changing position of the movie and relocate the graphics based on the location of the child movie.

I know a workaround would be to redraw the objects every frame after getting the new coordinates but i just wondered if there was a more simple way to do it. Sorry if i havent been too clear but im confusing myself here

Thanks in advance!
Andy

For Each Child In XML - Create Movie Clip
i am currently working on my portfolio, and one of the main things i want to do is load my images and swfs from xml.

at the minute i am just trying to load the right number of containers for the number of files in the xml.

i understand the logic of what needs to happen, but am unsure of a few coding snippets.
i think once i load in my xml file it will be something like

for each var item in xmlData.image //image being the xml element
{
clip = new movieclip()
}

i'm not sure if there needs to be a counter so it goes throgh and counts and then displays them, at the moment i just want to work on that, and maybe get a gap between each one so i can see them loading in.

i'm going to keep looking at it but if anybody can help me out with an example or sample code that would be great

thanks
Dan

Iterating Through Child Movie Clips In AS3
I am working on migrating a very large Flash project from AS2 over to AS3, however I've hit a snag.

One of the effects within the project is an animated 3D 'ribbon' effect. It draws animated ribbons which fly around in 3D space and eventually land in a predefined stationary position (where multiple ribbons come together to form a line art drawing). In order to define the points for this final resting position, the effect requires small movieclip guides to be positioned at key points on the line (these guides are hidden at runtime, of course). In addition to providing an x,y coordinate for the ribbon to pass through, the scale of these clips represents the Z coordinate for the ribbon at that point, and the rotation helps determine the bezier control points which fall between the guide MCs.

Each drawing (collection of ribbons that form a single picture) contains dozens of ribbons and hundreds of guides. This method of using movieclips as guides is essential, as it is the only way to allow a designer to visually see where the ribbons will ultimately be drawn. Entering the x, y, z and rotation information manually per guide is simply not feasible.

To differentiate between the different guides, the MCs names were standardized to include the ribbon name and guide sequence. A simple example of this might be a smiley face. The ribbon that would draw the mouth might have 4 points. They would have to be named StartRibbonMouth, MouthGuide1, MouthGuide2, and EndRibbonMouth. That would create a ribbon named 'Mouth' with a start point, 2 points in the middle, and an end point. That, along with the previously mentioned rotation and scale data would be enough information to determine the final position of the ribbon (the animated paths are randomly generated at runtime).

The problem I am having is finding the guide clips by partial name in AS3. Since each ribbon has its own name, and each guide has a unique sequence number, I need to find the clips based on a partial name search (specifically the name's prefix). For example, first I scan for all guides that start with "StartRibbon" to get a list of ribbons contained in the parent movieclip. Then I use that list to find intermediary points (guides that start with the name of the ribbon) and then I find the end point (by the full name "EndRibbon" + the ribbon name).

In AS2 I had a function to return a reference to a clip based on the name prefix. It was essentially as follows:


Code:
for (var Item in Parent) {
if (typeof (Parent[Item]) == "movieclip") {
if (Parent[Item].name.substring(0, Prefix.length) == Prefix) {
return(Item);
}
}
}
Where Parent was a reference to the MC which contained the group of guide MCs to define all of the ribbons for a particular drawing.

In AS3 it is skipping the for loop completely. So far all I can find is a way to get the child MCs by full name, but no way to iterate through all of the child MCs and check each name against a substring.

Any ideas?

Getting ALL Child Names From A Movie Clip?
I have about 200 movie clips within a parent container that I would like store in an array -- without having to type out all 200 instance names into the array build. Is there a function that would allow me to extract and store all child names so I can just use that variable to build the array?

Thanks!!

Loading .swf Into Child Movie Clip
Trying to get an exteranal .swf to load into the child clip of a Mc that slides an _x axis.

1. I am going from root time line to a clip called rooms.
2. In the rooms MC there are 5 Mcs horizantally aligned on different layers.
3. I experimented with the idea that I could create a blank Mc and load and exteral .swf into it's eaxct location within the Rooms MC.
4. I am using the following in my 1 st frame: loadMovieNum("kitchen.swf","load");

5. of coarse This is loading the external kitchen.swf into the child clip instance named load right?


help.

Thanks in advance

Passing Variables To Child Movie
I'm passing variables into my main movie through the query string and I need to know how to reference them from the child movies I'm calling in. Currently these variables are comming undefined in the child movies. I know that the query string method is the only one that will work in this situation. Other methods do not suit my situation e.g external text file or xml document. Please help!!<

Style Sheet In Child Movie
I am using css in a child movie, and it works perfectly when the movie is played alone. However, when the swf is loaded inside the parent movie, the css no longer works.

Here is the actionscript in the child movie I use to call the css:

PHP Code:



var errormessage = "<p class='three'>error message goes here</p>";
var format = new TextField.StyleSheet();
var path = "flash.css";
format.load(path);
format.onLoad = function(loaded) {
}; 




Here is the actionscript for the text box using the css:

PHP Code:



    errorBox.styleSheet = format;
    errorBox.text = errormessage; 




Any ideas?

Targeting A Child Movie Clip:
I have a movie clip on the main timeline calledbg_graphics, I want to target a movie clip within that movieclip called bg1_mc. to gotoAndPlay frame 2.

if anyone can help me out with this code that would be great, but wait theres more.

The bg_graphics clip goes to a random frame within that movieclip, there are 3 frames. 1st has bg1_mc, 2nd has bg2_mc, and 3rd has bg3_mc. How could i determine which file to gotoAndPlay frame 2 in bg_graphics when i don't know exactly which frame its going to be on, let alone target a movie clip within a movie clip.

I used this code to generate the random frame if that is of any use to anyone who is willing to reply.

function randomBg() {
//generate random BG based on random frames within the MC
randFrame = random(3)+1;
bg_graphics.gotoAndStop(randFrame);
}

Can anyone help??? that would be great.

How To Unload Movie On Root From Child?
I'm loading a movie in externally. The external movie has a button to unload itself from the main movie. It loads into _root.calContainer. The button is called xButton. This is the script that's not working:

_this.xButton.onRelease = function() {
_global.calContainer.unloadMovie;
}

I've also tried. _root.calContainer to no avail.

Parent/child Movie Clips
ok so i have a problem, i am relatively new to actionscript, my situation is:
1) i have all my actions in its own layer on the main timeline, so all is well there
2) i have a movie clip with a rollOver and rollOut events attached to it
3) inside the movie clip when the rollover happens and the movieclip stops at a certain frame, i have another movieclip that appears. the movie clip is a link to a website, it works properly on the main timeline but without the proper actionscript it of course will not work inside its parent movie clip

how do i fix this?

Targeting A Child Movie Clip:
I have a movie clip on the main timeline calledbg_graphics, I want to target a movie clip within that movieclip called bg1_mc. to gotoAndPlay frame 2.

if anyone can help me out with this code that would be great, but wait theres more.

The bg_graphics clip goes to a random frame within that movieclip, there are 3 frames. 1st has bg1_mc, 2nd has bg2_mc, and 3rd has bg3_mc. How could i determine which file to gotoAndPlay frame 2 in bg_graphics when i don't know exactly which frame its going to be on, let alone target a movie clip within a movie clip.

I used this code to generate the random frame if that is of any use to anyone who is willing to reply.

function randomBg() {
//generate random BG based on random frames within the MC
randFrame = random(3)+1;
bg_graphics.gotoAndStop(randFrame);
}

Can anyone help??? that would be great.

How To Unload Movie On Root From Child?
I'm loading a movie in externally. The external movie has a button to unload itself from the main movie. It loads into _root.calContainer. The button is called xButton. This is the script that's not working:

_this.xButton.onRelease = function() {
_global.calContainer.unloadMovie;
}

I've also tried. _root.calContainer to no avail.

[as2] Contolling Main Movie From Child
hello all,

i require your expertise on a small and probably simple problem.

is there a command in AS that will let me stop the main movie from a child movie? I have a stop() command in the child, but the main movie keeps on rolling. There must be a better way than counting frames and writing another stop(); in the main timeline.

sorry my explanation is so messed up. been up for days trying to finish this project.

adam

Load And Position A Child Movie Clip
Hi all!

I am currently making a mini-game using Flash.
Well, I got a silly question, just wondering if anyone can take some time to answer me =P

In my game, when the player click a button, I loads a child movie clip into the current movie clip, at level1
and want to position this child movie clip at a specified location.
I used the following script, attached to a button, to do the task.

on (release) {
loadMovieNum ("childMovie.swf", 1);
setProperty ("_level1/", _x, "300");
setProperty ("_level1/", _y, "280");
}

But when I test the game, as I click the button, the movie loaded and position at the (300, 280) coordinate, and immediately it re-position to (0, 0) again.
Everytime I clicked that button, the childMovie go to (300, 280) and then back to (0, 0) again...
Alternatively, I use the following scripts instead

on (press) {
loadMovieNum ("childMovie.swf", 1);
}
on (release) {
setProperty ("_level1/", _x, "300");
setProperty ("_level1/", _y, "280");
}
The output seems normal and the childMovie doesn't re-position. But when I keep holding down the mouse button, the childMovie stay at (0, 0) and go to (300, 280) as I release the button. This's not wat I expect...

Well, the only thing I want to do is to load a movie at (300, 280) everytime I click the button...
Can anyone give me some suggestion?

Thanks in advance.

Is It Possible To Toggle The Quality Of A Child Movie Clip Only?
hi,

is it possible to toggle the quality from a childmovie clip from high quality to fast quality while the childmovie clip is running? The quality change should only affect that specific child movie clip.

and if it's possible, how would the action look like?

thanks in advance

xant

Controlling Parent Movie From Child Menu
I know this is probably simple, but I am trying to load a menu into level 3 that has b uttons that control where you go in the main parent movie...

something like:

_parent.gotoAndPlay(2,frameLabel);

where 2 refers to scene 2 in the parent, and frame label is just that...

I want to be able to click on the buttons from the child movie and be sent to scene 2 frame label x... and then have the movie close...

I can cllose it alright, but I cant the parent to respond...

Any thoughts would be greatly appreciated...

Paul

Keeping Child Movie Clips Looping
Let's say I have movie clip A which contains clips B. I want to tell B at some point to gotoAndPlay frame 'foo', and I know I can do this by the script a.b.gotoAndPlay("foo") somewhere on the parent timeline.

But A has several keyframes of animation that loop, and does this mean different instances of B for each?

What I get is B going to "foo" and starting to play that part but when A reaches the next keyframe of animation B jumps back to the start and resets to original frame.

I'd like B to keep looping it's new section of play regardless of what frame it's parent is on, can anyone help?

Weird Movie.width From Child Error
so i have a clip called intro.swf
in it, it has a skip mc that if you click on it, calls _parent._parent.intro_done

later in the timeline, i call that same method, _parent._parent.intro_done

the thing is...
if i click the skip mc, the next scene loads appropriatly, getting the height and adjusting the screen

if i let the clip play, the next scene loads, but the screen doesnt resize
its like, since the clip is calling the parent method on its own, it doesnt fully respond???

any clue why that would be?

project still in prototype phase, so please, no ragging
http://www.dcmdesign.net/work/00_nls...nls_build.html

Loading External Movie Into Child Slide
I need to load an external movie into a child slide named "formular1". How can I do that when I already created an empty movie there?

Thanks a lot...

Marlin

Child Movie Won't Play When Loaded Second Time
I used the movie pageflip, which flips pages on onmousedown of the page corner. When I load the movie into a parent movie, it plays, fine. But I load it again the pages do not flip. Even I reload the parent movie the pages won't flip the second time the movie is loaded.

What's going on here? Anybody observed this? Has it something to do with cache?

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