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








Child Swf's Scaling To Size Within Parent Swf At Runtime


Hello,

I am experienced coder in lots of technologies but am new to flash, excuse me if this question is derivative of my actionscript stupidity.

My mission is to create a site made up of all sorts of database driven components, each as a swf movie, loaded dynamically onto a main swf at runtime as required. This is going well, and i am creating dynamic database configured colours and shapes, gradient shadings and animated fade effects, text and user input, like a duck to water, except i am getting a bit stuck putting my components together on the main swf.

The key with this technology for me is to get every swf component to manage its own proportions with an onResize event driven rendering, so that I can optimise presentation always to fit users browser size. I can get this automatic rendering to work on my swf files, for each component, but now I am trying to dynamically load a component into a parent swf.

In the child swf I am making lots of use of Stage.width and Stage.height to govern my proportional positioning at runtime, but when loading the movie into a parent swf at runtime I cannot seem to control the sizing. On a basic load into the parent using first createEmptyMovieClip followed by .loadMovie the child swf loads in fine but references to the Parent stage proportions, and when I try to set the ._width and ._height properties of the new movieclip i seem to get no results at all!

PS: when i say component i am not actually building components as such, just small swf movies i want to use multiple times in a parent movie.

Can somebody suggest a couple of lines of code to point me in the right direction please, or just a sentence even if it is "you have to do it using components" many thanks,

Daley.




FlashKit > Flash Help > Flash ActionScript
Posted on: 10-27-2003, 04:05 PM


View Complete Forum Thread with Replies

Sponsored Links:

Contraining The Scaling Of A Shape Within A Movieclip That Changes Size During Runtime
I am using flash 8 and actionscript 2
Is the any way to constrain the scaling of a shape within a movieclip of shapes and lines that changes size during runtime.
For example.
I have a clip full of shapes and lines that I can change the size of during runtime using actionscript.
I have noticed that I can set lines within that clip so that the thickness of the lines remains constant.
Can the same be done with a shape?
So that it the width of the shape scales in proportion the clips width as the clip changes size
but the height remains constant.

hope this makes sense.

View Replies !    View Related
Changing Size Of Child Clips To Match Parent Movie Clip?
I have a program that is dynamically loading images into a nested movie clip. The Parent movie contains the two separate movies within it and images are to switch back and forth in them. I need to know how I can use action script to load these nested movies to the exact dimension of the parent movieclip.

Here is my code:

onClipEvent (load) {
StagePictures._lockroot = true;

e_mc.loadMovie(_root.PathText+_root.imageClips[0]);

}
onClipEvent (enterFrame) {
if (Key.isDown(a number)) {
if (Key.isDown(Key.something)) {
if (Key.isDown(a number)) {
_root.StagePictures.e_mc.createEmptyMovieClip("Sec ondClip" , 3);
_root.StagePictures.e_mc.SecondClip.loadMovie(_roo t.PathText+_root.imageClips[1]);
_root.ScoreBox.text = scvar+1;
_root.Command.text = _root.imageCommand[1];
_root.Response.text = "Correct!";
}
}
}
}

StagePictures is the parent clip, e_mc is a child, and SecondClip is a child within e_mc.

Both e_mc, and SecondClip are loading the dynamic images which are the paths labeled _root.PathText+_root.imageClips[0, and 1];

The size of the images need to be contained within the size of the parent clip of both called StagePictures.

How can I set the size of the two nested clips to match the parent?

Thanks,
sam

View Replies !    View Related
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.

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
Parent And Child Swf
Hi,
Can anyone help please, I basically just want to call my main (parent) swf from the current clip (child) am in.
I just don't know how to write it, having a blank right now, it must be in the code line below, where i need to somehow add the name of the swf to the name of the button:
_root.but._visible = true;

Here is it in a bit more detail if needed:
I have 2 swfs, one is the main one that has buttons in it, when this button is clicked it loads a new semi transparent swf on top of it into an empty clip in my parent swf. When doing that I make the button in the parent swf invisible.
I have one close button which sits in the semi transparent swf on top, when this button is pressed it unloads itself and reveals the parent swf underneath again.
Now I want to add a line into my function that makes the button I previously made invisible, visible again so I can use it again, preferably when pressing the unload button of my semi transparent swf on top.

This is the parent swf clip function:
but.onRelease = function() {
trace(this._name+"._visible = false");
this._visible = false;
empty.loadMovie("top.swf");
};


This is top swf clip:
close_btn.onRelease = function() {
unloadMovie("");
trace(this._name+"._visible = true");
_root.but._visible = true;
};

View Replies !    View Related
XML From Child From One Parent
Sorry for the simple question, I'm still learning as3. Let's say I had an XML document and I just wanted to retrieve info from all the children of only one parent how would I do it. Using my XML example, I would like to retrieve all the images for the first person only, but I will want to use a button to switch to the next.

It seems like "var myXmlList:XMLList = myXMLData.person.image;" would do it but, it lists all "image" nodes

<root>

<person>
<image></image>
<image></image>
<image></image>
<person>

<person>
<image></image>
<image></image>
<image></image>
<person>

</root>

View Replies !    View Related
URGENT - Parent & Child MCs
Hi All..

Plz help me..i am in very urgent need...My problem is..I got a MC say 'Parent_MC' , which internally has got another Mc called 'Child_MC'. Now the problem is i am dynamically resizing the 'Parent_MC' Movie Clip...accrdinlgy the 'Child_MC' is also changing its Dimenstions...i want to keep the oroginal dimanstions as they are for 'Child_MC' movie clip...how can i do that...any suggestions plz gimme immediately..

Thanks to all in adv,

View Replies !    View Related
Using Child To Control Parent, Help
Hello,

I have a menu which resides in the library and is achild which controls the parent. When the buttons are released I'm using this action to navigate from scene to scene

on (release) {
with (_level0.gotoAndPlay(49)) {
}
}

In this instance there is a blank keyframe on frame 49 which has a gotoAndPlay action to another scene. I know this is jury rigged I get a

"Error: A 'with' action failed because the specified object did not exist."

In the output window. But it has been working fine, that is until I added a scene to begining of the movie. Now it just jumps around the scene it's in. Does anyone know the correct script for a child symbol that controls the parent scene?

Cheers

View Replies !    View Related
Targeting Parent Swf From Child Swf.
If I want to tell the parent swf to gotoAndPlay at a certain spot from a rollover on the child swf,
what action would I use?

Could I use:

on (rollOver) {
_level0.gotoAndPlay("myFrame");
}

How would I specify my scene?

View Replies !    View Related
Loader In Parent Or Child
Hello everyone,
I have a question and i need your help.
I made a movie with buttons that calls other movies with the LoadMovie
action. The question is were i should put the preloaders for those movies???

View Replies !    View Related
Child, Parent Transfer
hi Guys
Is there a way to transfer somehow a child movieClip to another parent. if i have for example a MC called "parent" and "parent" has an mc "child".(_root.parent.child)
Can i transfer the "child" MC to "parent2".
(_root.parent2.child)??
is this possible somehow? maybe via duplicating and deleting? plz help
thx

View Replies !    View Related
Moving Parent - Still Child
I am a long way into a long movie and need to start moving my parent clip, while keeping some children clips stationary.

I can see I need to subtract parental movements frome childish positions, but I am a bit unclear on where to put the code.
Has anyone tried this or know a of a good tutorial.

I have attached a super simple .fla of a moving parent and child. I just want to keep the child still on screen.

Thanks, Tim.

View Replies !    View Related
Child Parent Relationships
I've got a popup window with a flash movie in it which I want to be able to control the main window from (a bit like a remote control).

I was under the impression that the popup window was known as a 'child' page and the page it came from was its 'parent'

If this is or isn't the case, how does this work? I'm using:

on (release) {
getURL("contact.htm", "_parent");
}

which I thought might do it........

Any ideas?

View Replies !    View Related
Load Child.swf Into Parent.swf
can someone please get me started, i've gone through all the tut's provided on this site, step by step and the end result never works for me

I simply need to load child.swf into parent.swf

View Replies !    View Related
Preloading Child From Parent
okay here is my set up
I have a parent .swf called "demo.swf"
and a child caled jukebox.swf

within "jukebox" I have 4 movie clips
each with it's own instance name
In each movie the first frame is empty with the stop(); action
then in frame two a song starts to stream

within the demo.swf I have 4 buttons
each with this script (instance names change of course)


Code:
on (release) {
stopAllSounds();
_root.jukebox.song1.gotoAndPlay(2);
}
now my issue..
Is it possible for me to preload the jukebox.swf, with a progress bar sitting in the demo.swf?

Cause as it stands when you first open the site, and go to the audio section, only one of the four songs will play.. (ie: not done loading yet)
if you refresh the page they then all play

View Replies !    View Related
Load A JPG From Child.SWF And See It In Parent.SWF
Hi everyone..

I'm trying to load a image.JPG into a child.SWF. The parent.SWF contents child.SWF and when I load the child.SWF from parent.SWF everything is perfect, but image.JPG loaded from child.SWF doesn't show up in parent.SWF.

Code for loading image.JPG (in child.SWF):

code:
_root.createEmptyMovieClip("image",301);
image._x = 180;
image._y = 130;
image.loadMovie("image.jpg");

--------------------------------------------
Code for loading child.SWF (in parent.SWF):

code:
_root.createEmptyMovieClip("child_mc",200);
child_mc._x=0;
child_mc._y=0;
child_mc.loadMovie("child.swf");


thank you in advance

View Replies !    View Related
Loading A SWF Into Parent SWF From Child SWF
Hi folks!
I have a silly problem I can't figure out.
I want to load a SW from a 'deeper' SWF into a 'upper' SWF.

The details:
I have a 'top SWF'. At this top SWF, there is a empty container named pixcontainer. Into this top SWF there is loading a 'main SWF'. Into that main SWF there will be loading a 'detail SWF' (all loading SWF are loaded with loadMovie() ).
Now, I need to know the correct path so I can trigger a loadMovie from the detail SWF into the empty container of the top SWF.
I tried _root.pixcontainer, _parent.pixcontainer, _root._parent.pixcontainer, nothing worked.
But there has to be a way to fill this empty container in the top SWF.

Any hints and tips for a AS noob?

View Replies !    View Related
Communicating Between Parent & Child Swf's
Hi everybody!

I'm using loadMovieNum to load external swf's into my MAIN.swf for the content on my site.

The movies are being loaded on to levels not targets.

So I have loaded SECTION2.swf into MAIN.swf

The problem I have now is that I need SECTION2.swf to send a command to MAIN.swf.

It is only a simple command that I need to send from SECTION2.swf to MAIN.swf:


code: _root.gotoAndPlay("start");

I have also tried:

code: _level0.gotoAndPlay("start");


Is it possible to send actionscript commands between swf's?

And if so, does anybody know how to achieve it?

All help is very much appreciated!

D.

View Replies !    View Related
Parent And Child Swf Troubles..
Hi,

flash 7 actionscript 2.

I have a child swf file that gets loaded into a parent swf file. The child swf file then creates a blank movieClip called target in the parent swf file then the child swf loads a swf file into the target movieClip in the parent. The parent can control the child movieClip perfectly fine locally but when it's uploaded to a server it does not work. If i put a text field on the stage and display target.. it shows up as undefined but when i run it locally I get level0.target.


myBook.onClick = function(i, page, isCorner) {
hideHint();
if(isCorner) {
target._visible = false;
target.stop_start.gotoAndStop(1);
target.voiceover.stop();
clearInterval(target.movie_interval);
}
};

the above code works fine locally how do i go about telling my parent swf that the target movieClip is ready for use?

also can you preload a movieclip that already has a preloader on it?

thanks a bunch.

View Replies !    View Related
Child Knowing What It's Parent Is
I've been learning some AS3, reading the tutorials but there is something i don't quite understand about DisplayObject


PHP Code:



package {
    import flash.display.*;
    public class MainClass extends MovieClip {
        public function MainClass() {
            var myMovieClip:ExampleClass = new ExampleClass();
            this.addChild(myMovieClip);
            trace(myMovieClip.parent); //outputs: [object MainClass]
            
        }
    }
}





PHP Code:



package {
    import flash.display.*;
    public class ExampleClass extends MovieClip {
        public function ExampleClass() {
            trace(this.parent); //outputs: null - why does this not return MainClass?
            
        }
    }
}




Why can't the child seem to be able to find what it's parent is? Is this possible to do?

View Replies !    View Related
Child Parent Interaction
how to make a child recognize its parent

for example:

if i have a parent mc
and I want it to duplicate a child
so that the new child is on top of the parent

how can i do this in a way so that
the code to position the child is in child's class
and for it to be relative instead of absolute

in other words
how to make a child recognize its parent

thnx in advance

View Replies !    View Related
[MX]Child And Parent Objects?
Can you Child and Parent objects as in, say, After Effects? Like when you move one object the other object stays in the same position realitive to the first. It moves when the other moves?

View Replies !    View Related
Parent Not Consistently Available To Child Swf
OK, I thought I understood that you could access properties and methods of the parent of a loaded SWF by casting appropriately so that the compiler didn't mind, BUT:

I have an SWF that I'm loading into a movieclip container that is on the main timeline of another SWF. It contains this code:


PHP Code:




function fadeInContent()    {    MovieClip(parent.parent).fade(bioBlock_mc, 1, .7);    MovieClip(parent.parent).fade(picBlock_mc, 1, .7);    MovieClip(parent.parent).fade(menu_mc, 1, .7);    }







I call this function from the main SWF by this call:


PHP Code:




contentRef.fadeInContent();







and it works just fine. The function fires and it calls and runs the fade() method back on the main timeline.

But further down from fadeInContent(), I've defined another two methods:


PHP Code:




function imagesLoaded(e:Event)    {    loadCount++;    trace("image complete, loadCount is "+loadCount+"e.target is "+e.target.loader);    switch (e.target.loader)        {        case this.imageLoader0:            image1 = new BitmapData(232,232);            image1.draw(this.imageLoader0.content);            image1bm = new Bitmap(image1);            image1bm.alpha = 0;            image1bm.name = "image1bm";            picBlock_mc.addChild(image1bm);            break;        case this.imageLoader1:            image2 = new BitmapData(232,232);            image2.draw(this.imageLoader1.content);            image2bm = new Bitmap(image2);            image2bm.alpha = 0;            image2bm.name = "image2bm";            picBlock_mc.addChild(image2bm);                        break;                case this.imageLoader2:                    image3 = new BitmapData(232,232);            image3.draw(this.imageLoader2.content);            image3bm = new Bitmap(image3);            image3bm.alpha = 0;            image3bm.name = "image3bm";            picBlock_mc.addChild(image3bm);                break;                }            //imagesComplete = true;    if (loadCount == 3)            {        _complete = true;        loadPage(1);        }    }    function loadPage(pageNum:Number)    {    for (var i:Number = 1; i < 4; i++)        {        if (pageNum == i)            {            trace("MovieClip(this.parent.parent) is "+MovieClip(parent.parent));            //MovieClip(parent.parent).fade(this["image"+i+"bm"], 1, 1);            MovieClip(parent.parent).fade(bioBlock_mc, 0, .5);            }        else            {            trace("MovieClip(this.parent.parent) is "+MovieClip(parent.parent));            //MovieClip(parent.parent).fade(this["image"+i+"bm"], 0, 1);            }        }    }







But when the loaded SWF runs the imagesLoaded event handler the third time and it calls loadPage(), the call to fade() back on the main SWF's timeline does not work. MovieClip(parent.parent) traces null, when it just was used to call fade earlier when the SWF was loaded...????

Can anyone tell me why this would be?

Many thanks.

View Replies !    View Related
Child (swf) Getting Variables From Parent (swf)
Hello there ^^

Is it impossible to get a child movie loaded in an external swf to tell the parent swf to do something like gotoAndPlay(2) ?

here's my code:


ActionScript Code:
var variable1:String = "yeah it worked !";
var base:MovieClip = this;
import flash.events.Event;

//request
var request:URLRequest = new URLRequest("clip.swf");
var clip:Loader = new Loader();

function loading_complete(e:Event) {
    var external_swf:MovieClip = MovieClip(clip.content);
    stage.addChild(external_swf);
    swf_externe.gotoAndStop(2); // this works good
}//fin fonction


clip.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, loading_complete);


clip.load(request);

and now, in my file named clip.swf I have a code that says to the swf that called him in the first place to do something really simple:


ActionScript Code:
var variable2:String;

And I do not know how to tell my variable2 to take the value of the variable 1 taken from the parent file of the child clip.swf. Or just something simple like gotoAndPlay(5) from the clip.swf file to tell my first swf to go to image 5 and play... I looked through the net and I didn't find anything about that... please, if someone knows how to do that, that would help me big time

View Replies !    View Related
Child Swf Talking To Parent SWF
Hi, I have a SWF file that I call the a parent, it imports a number of SWF(children) which I can switch through. Now my question is, is it possible to have a function in the parent SWF that the child SWF can launch?

The reason I need this is because each child SWF is a sort of small game, so when each game is finished I need some kind of way to let the parent SWF know that the player can continue.

Am I making any sense?

View Replies !    View Related
Placing Child Behind Parent
I am making a planetary/solar system with sun as the parent and the planets as the children.
Now, I want the child to go behind the parent during some part of revolution and come in the front during some other part so as to give a 3d effect.

But it seems that the children are, by default, positioned in front of parent. I want to ask whether there's a way in actionscript 3.0 to make the child go behind the parent.

View Replies !    View Related
Child Communicating With Parent
Hello, I'm relatively new to as3. I'm having problems getting a swf file that's being loaded into an mc to talk to the swf that loaded it. The loader is named site. When you hit "nurseing services training", I want it to run the ParentFunction() in the loader. I've looked on here and other sites and done what they say to do but to no avail. When I compile the nurseing services training, it gives an error about the parent.parent. Should I be compiling it differently since there's no parent to the nursing main timeline?

Any help would be appreciated!
nursing services training.zip

View Replies !    View Related
Child Swf In Parent Swf Problems
Hi, I'm trying to create a parent swf file that grabs multiple child swf files. I've managed to do this, but I have a big problem. I want the parent swf file to act like an application skin (Television-TV.swf), and I want the child swf files to load under the skin (TV movie-Movie.swf).

I can't get this to work correctly. When I test my presentation, my TV movie loads over the TV skin instead of under it.

Here's a little info about my setup in my parent swf file (TV.swf):
Layer 1: TV Skin
Layer 2: TV Movie

Action script attached to the TV Movie frame in the timeline:
loadMovieNum("Movie.swf", 1);

So how in the world do I get my child swf files to load under the skin in my parent swf file? How do I change the location where the child swf files appear? (right now they load in the upper left hand corner of the presentation)

Thanks

View Replies !    View Related
Communicating Between Parent & Child Swf's
Hi everybody!

I'm using loadMovieNum to load external swf's into my MAIN.swf for the content on my site.The movies are being loaded on to levels not targets.

So I have loaded SECTION2.swf into MAIN.swf

The problem I have now is that I need SECTION2.swf to send a command to MAIN.swf.

It is only a simple command that I need to send from SECTION2.swf to MAIN.swf:


ActionScript Code:
root.gotoAndPlay("start");

Is it possible to send actionscript commands between swf's?

And if so, does anybody know how to achieve it?

All help is very much appreciated

D.

View Replies !    View Related
Getting A Child To Disobey Its Parent
I am having a problem with getting a flv that is loaded into a swf by the flv component to stay at its original dimensions regardless of what resizing is done to the parent swf. The problem occurs because it is in a flash flip book and the swf's are called in as pages, however, depending on the size of the book, the swf pages are scaled to fit. When the flv tries to match the same size, (either upscaled or downscaled) it becomes very pixelated? I've messed with the scale properties with the flv but it still obeys the parent swf?

This is a time sensitive matter and I am even willing to pay for a solution!!! (Of course, I would also accept a "You're an idiot" comment followed by a free solution!) :) Please help.

- BB

View Replies !    View Related
Best Way To Communicate Parent - Child
I've got an CS3 Flash swf (parent - AS3) that has 2 sound objects. When the parent loads an external swf file (the child - AS3), what is the best method for the child to obtain properties of the sound objects contained in the parent?
ApplicationDomain seems like overkill... in this case anyway

thanks
Dan
Salem, Oregon

View Replies !    View Related
Parent/Child Communication In CS3
Hello -

I have a movie setup that imports another external swf file. I am trying to get the two movieclips to communicate with eachother. I am able to call a function in the child movie from the parent movie, but I cannot get the child movie to call a function in the parent movie.

parent.functionName(); results with an error #1061 call to a possibly undefined method.

I'm really banging my head on my desk with this one, it seems that this should be very simple (it was in AS2 anyway) but I just cannot get it to work. Any help would be greatly appreciated.

thanks
~Dave

View Replies !    View Related
Components, Parent And Child
Hi Everyone

I've created a component within a component, however when I'm trying to change the property of the child component I can't. I can only change the parent component.

compOne.compTwo.move(x,y); // Does nothing.
compOne.move(x,y); // Moves the parent component, to x and y.

Have I got the syntax wrong?

View Replies !    View Related
Parent / Child Problem Maybe? Not Sure... HELP
Hi, I'm new to this board but I've looked around trying to find the answer to my problem and it sounds like I might actually find the answer. So here's the problem: I have a parent swf that loads 5 child swfs. Everything loads fine but after the xml loads the data there is no functionality on the child swfs other than the listen command to use the left and right keys to switch between images. The scrolling and buttons on the child swf become deactivated.

I've traced the problem to the activateButtons() function. I've tried modifying it with no luck. If I comment out the function then the child swf works and the parent swf doesn't.

I got the code for the parent swf online and I can't even remember where, but here it is (modified):


Code:
makeButtons();
import mx.transitions.Tween;
import mx.transitions.easing.*;
Object.Main = this;
var distanceMove = 545;
onLoad.moveButtons(0);
function galleryChoice(q) {
tArray = new Array();
my_xml = new XML();
for (var j = 0; j<curLength; j++) {
this.th_nav["thmb"+j].removeMovieClip();
}
my_xml.ignoreWhite = true;
my_xml.onLoad = function(loaded) {
if (loaded) {
gallery = this.firstChild.childNodes[q];
curLength = gallery.childNodes.length;
for (var i = 0; i<gallery.childNodes.length; i++) {
tArray.push(gallery.childNodes[i].attributes.movie);
}
}
delay = setInterval(makeButtons, 10);
};
my_xml.load("samples.xml");
}
function makeButtons() {
tnNr = 0;
clearInterval(delay);
for (var i = 0; i<tArray.length; i++) {
var thb = container.thumb.duplicateMovieClip("thmb"+i, 1000+i);
//
//trace(pArray[i]);
thb._x = 165+(i*48);
//container.thmb5.menuTitle
//trace(thb.menuTitle.text = pArray[i]);
thb.txt.text = pArray[i];
}
loadButtons();
}
function loadButtons() {
var tbox = container["thmb"+tnNr].box;
tbox.loadMovie(tArray[tnNr]);
temp = this.createEmptyMovieClip("tmp"+tnNr, 999);
temp.onEnterFrame = function() {
bt = tbox.getBytesTotal();
bl = tbox.getBytesLoaded();
if (bt == bl && bt>4) {
nextButton();
delete this.onEnterFrame;
} else {
activateButtons();
}
};
}
function nextButton() {
if (tnNr<tArray.length-1) {
tnNr++;
loadButtons();
} else {
activateButtons();
}
}
function activateButtons() {
for (var i = 0; i<tArray.length; i++) {
var but = container["thmb"+i];
but.id = i;
//trace(but.id);
but.onRelease = function() {
moveButtons(this.id);
lastPos=this.id;
};
but.onRollOut = function() {
//moveButtons2(this.id);

};
}
}
function moveButtons(pos) {

//trace(lastPos);
for (var j = 0; j<tArray.length; j++) {
startX = 165+(j*48);

if (j<=pos) {
var myTween:Tween = new Tween(container["thmb"+j], "_x", mx.transitions.easing.Strong.easeOut, container["thmb"+j]._x, startX, 3, true);
} else {
var myTween:Tween = new Tween(container["thmb"+j], "_x", mx.transitions.easing.Strong.easeOut, container["thmb"+j]._x, startX+distanceMove, 3, true);
}
}
}
function moveButtons2() {
for (var j = 0; j<tArray.length; j++) {
startX = 165+(j*65);
var myTween:Tween = new Tween(container["thmb"+j], "_x", mx.transitions.easing.Strong.easeOut, container["thmb"+j]._x, startX, 1, true);
}
}
galleryChoice(0);
Here is the child swf code:


Code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("web.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 7;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function thumbNailScroller() {
// thumbnail code!
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 7;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=(hit_left._x+40)) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(target_mc._width+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
I really appreciate any help I can get, and this is really urgent. THANKS!

-JoshDV

View Replies !    View Related
Child Targeting Parent - AS3
Would someone please help me to correctly get a LOADED SWF to target a LOADER SWF?

I have a button in the LOADED SWF that "addChild" to the LOADER SWF.

I have the following action in the LOADED SWF:

stage.root.parent.addChild(button_btn);

It doesn't work and the error message is: "Access of undefined property button_btn"


Any help would be deeply appreciated!!

View Replies !    View Related
Child Parent AHHHHHH
Hey there guys,
addChild is handy in a lot of ways but has (for me) made some of the simple things harder.
My problem is loading a movieclip in a container and then replacing it with another.
in as2 you would just attachMovieClip on the container and it replaces the last clip.
If i do it in as3 it just adds it to the stack is there an easy way round this anyone that i am missing? so i can easily load a clip and remove whatever is in the container.


Cheers for your help...:-)

View Replies !    View Related
Parent SWF - Child SWFs
i followed the Kirupa tutorial (Creating a Full Flash Site - http://www.kirupa.com/developer/mx/full_site.htm) and i get everything so far.

now, i have a main SWF that has a placeholder for all subsequent child SWFs, but unlike the tutorial stated, each child SWF has its own navigation that needs to load a new SWF into the placeholder on the parent.

so to clarify, the main page just has a placeholder for new SWFs. then when the first child SWF loads, it gives the user two options (English or French). if the user selects English, it should load the English child SWF into the parent placeholder.

how is this done?
in the tutorial, kirupa has embedded the navigation into the main parent and so loading new SWFs into the placeholder is no issue.

please help...thank you.

View Replies !    View Related
Child SWF Talking To Parent SWF
Hi, I have a SWF file that I call the a parent, it imports a number of SWF(children) which I can switch through. Now my question is, is it possible to have a function in the parent SWF that the child SWF can launch?

The reason I need this is because each child SWF is a sort of small game, so when each game is finished I need some kind of way to let the parent SWF know that the player can continue.

Can anyone help me with this?

View Replies !    View Related
Using Path Of Child Swf Instead Of Parent Swf
I am loading a swf (child) into another swf (parent). They are located in different folders.

The child swf loads an image and displays it on the stage. The URL of the image is specified as a relative path. I am realizing that the relative path is taken with respect to the main container (parent swf). Is there anyway to resolve this (something similar to lockroot for example) ?

Thanks. Hopefully a simple question.

View Replies !    View Related
Parent/child Communication
I've replicated my problem in the attached files.

Index.fla executes a loadMovieNum, loading the movie bbb.fla. bbb.fla tries to change the alpha of an object in the parent movie, Index.fla, but it does not work.

so say i have a button in bbb.fla, which goes:

on(release){
_root.box._alpha = 10;
}

but this does not change the alpha of instance box in the file index.fla. i've tried to change _root to _parent, and even tried a _root.MovieClipInstance.box... etc.

Please help

View Replies !    View Related
Child SWF Won't Talk To Parent SWF.
I have a SWF that loads other SWF files into a loader. How do I get the loaded SWF to talk to the loading SWF. I want the loaded SWF to remove a listener from a button in the main SWF while the loaded SWF is playing.

I tried a few combinations of this.parent and so forth but none of them seemed to work.

Does the loaded SWF need to make a "loader.parent" type of call in order for this to work?

This is my Loader in the main SWF

ActionScript Code:
// SWF Loadervar fullLoader:Loader = new Loader();// Controls for loader loopvar p:Number = 0;var nextModule:XMLList;//This is from the loader loop that examines the xml file.nextModule = phoneModules.module[p + 1].@source; //Puts next XML item in "nextModule" variable        fullLoader.unload();        SoundMixer.stopAll();        fullLoader.load(new URLRequest(nextModule));        p++;

Thank you in advance for any help you can provide.

View Replies !    View Related
Child Not Listening To Parent, Please Help
This code is in my SWF playing inside of another SWF.


ActionScript Code:
function triggerFour(){    addChild(line7);    addChild(playSound);    TweenGroup.allTo([line2, line3, line4, line5, line6], 1, {alpha:0, stagger:0.2, delay:16});    TweenMax.to(line7, 1, {alpha:1, y:150, delay:17});    TweenMax.to(playSound, 1, {alpha:1, y:225, delay:19});    playSound.addEventListener(MouseEvent.CLICK, playGreet1);    playSound.buttonMode = true;}function playGreet1(event:MouseEvent):void{    soundController = greeting2.play();    soundController.addEventListener(Event.SOUND_COMPLETE, greetTwo);}


On it's own it plays fine, but when I fire it up in the parent SWF the button doesn't work.

I've tried the following with no luck at all:

ActionScript Code:
playSound.parent.addEventListener(MouseEvent.CLICK, playGreet1);playSound.parent.parent.addEventListener(MouseEvent.CLICK, playGreet1);


Where am I going wrong here?

Any help is very much appreciated.

View Replies !    View Related
AddChild To The Parent From The Child?
Hi guys!

I have a main.fla with a MovieClip thats on the timeline that I load a background into!
The Movieclip has an instance name of bg.

Now, I wonder if it´s possible to load another background into that layer/frame/MC from the player.swf that I loaded from the main.swf

I thought

ActionScript Code:
public function bgLoaded(event:Event):void        {            this.parent.parent.bg.addChild(this.bgLoader);            fadeTween = new Tween(event.target.content,"alpha",None.easeOut,0,1,0.5,true);        }

would do it, but no luck there

Any thoughts and any help would be very much appreciated!

Thanks in advance!


/rundevo

View Replies !    View Related
Components, Parent And Child
Hi Everyone

I've created a component within a component, however when I'm trying to change the property of the child component I can't. I can only change the parent component.

compOne.compTwo.move(x,y); // Does nothing.
compOne.move(x,y); // Moves the parent component, to x and y.

Have I got the syntax wrong?

View Replies !    View Related
Parent - Child Properties In MX?
Hi,

I'm trying to figure out how to do this in the most efficient way in MX:

- I like to have a series of images that I can zoom into in a linear fashion. So, if these images are embedded into each other, when I zoom into one, I like to zoom the others by a
specific percentage automatically

- This is very similar to After Effects parenting feature whereupon when you do something to the parent, the children follow suit.

How is this done in MX? Appreciate any help or info.

John

View Replies !    View Related
[AS] Moving Parent - Still Child
Hi again,

I am a long way into a long movie and need to start moving my parent clip, while keeping some children clips stationary.

I can see I need to subtract parental movements frome childish positions, but I am a bit unclear on where to put the code.
Has anyone tried this or know a of a good tutorial.

I have made a super simple example .fla of a moving parent and child. I just want to keep the child still on screen.
http://www.flashkit.com/board/attach...postid=2652101

Thanks, Tim.

View Replies !    View Related
Child Not Controlling Parent Right.
I've got a mc on stage called movieName
within movieName (which acts as a button) I have another mc button appear on a certain stopped frame.

The code attached to this button says:

on(release) {
_parent.gotoAndStop(1);
}

It's a "close" button, to reset the parent back to its default frame, but it's not doing anything. Any suggestions?

I tried this._parent.gotoAndStop(1); but that ain't flyin' either.

View Replies !    View Related
Controlling A Parent Swf From The Child
I have a main.swf. Into this I'm loading a background.swf
The background.swf contains a masked image. What I want to
do is stop the parent (main.swf) while the preloader and image load from background.swf
I've tried playing about with _parent.stop but unfortunately
this is stretching my vast flash experience to the limit already.

Any help or links would be very welcome.

Cheers guys/girls.

View Replies !    View Related
Parent/Child Problem.
Ok another problem -

I have 3 scenes in my swf. The first scene is the intro and the second is the interface. In the interface I have a child movie which I want to direct back to the 6th frame of the parent in the interface. I use the following code but what seems to happen is that it directs the swf. back to the 6th fram of the intro.

_root.gotoAndPlay(6);


Can anyone help please? Tann?

View Replies !    View Related
Control Parent Clip From Child?
I have a child clip -- "base"
and a parent clip -- "form"

I want "base" (which is on "form"s frame 90) to tell form to go to frame 46.

How do I do this?

~DW~

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved