PDA

View Full Version : Make mc appear within scrollpane


Renge
01-18-2006, 11:20 PM
I have a mc (named Symbol1) that xml data is being dynamically ported into. It works. It also has a linkage name on it.

How can I then make that mc be what's inside a scrollpane?

I tried this code:
this.scrollpane.setScrollContent(this.Symbol1);

and I placed that within my xml load function.

On the stage, I have an instance of the ScrollPane component, with an instance name of "scrollpane".

Didn't work, though.

Help...Tnx!

deadbeat
01-18-2006, 11:29 PM
ScrollPane.contentPath:

http://www.macromedia.com/livedocs/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004&file=00002772.html#wp3157806

K.

flashead
01-18-2006, 11:33 PM
I tried this code:
this.scrollpane.setScrollContent(this.Symbol1);

and I placed that within my xml load function.
That looks like your problem right there. (assuming that by 'xml load function' you meant the onLoad handler)

Using 'this' inside your onLoad will reference the xml object that onLoad is associated with.

So you have a couple options:
1. Either remove 'this': scrollpane.setScrollContent(Symbol1);
2. Or set up a scope variable outside your xml object and set it to 'this', and then use that in place of 'this' in your current code.
i.e.var main = this;

var porkSausage = new XML();
porkSausage.onLoad = function()
{
main.scrollpane.setScrollContent(main.Symbol1);
};

Renge
01-18-2006, 11:47 PM
After reading info on that link (tnx!!!), I tried the following:

I created 1.swf that had just static content.

On the other, 2.swf, I placed my ScrollPane component (with instance name of "scrollpane") on the stage and added this code to it:

scrollpane.contentPath = "1.swf";

2.swf loaded 1.swf into the ScrollPane component.

But when I changed the 1.swf to have XML data that is dynamically ported into it (and of itself it works), and then viewed 2.swf, my ScrollPane component is now not showing anything.

Renge
01-18-2006, 11:57 PM
Hi, flashead.

I tried both your options, and I'm still getting a blank ScrollPane.

I also tried using _root.scrollpane.setScrollContent(_root.Symbol1); and also _root.scrollpane.setScrollContent(Symbol1); but neither worked.

deadbeat
01-19-2006, 12:01 AM
setScrollContent was the old, v1 component method for loading content into a scrollpane...

contentPath is the v2 component equivalent...

K.

Renge
01-19-2006, 12:08 AM
Yip, I used that "contentPath" but the ScrollPane is still not able to handle a swf that has dynamic content, I guess.

flashead
01-19-2006, 04:21 AM
setScrollContent was the old, v1 component method for loading content into a scrollpane...
yeah you're right db.

Yip, I used that "contentPath" but the ScrollPane is still not able to handle a swf that has dynamic content, I guess.

it must be able to.
v1 could.
you might just be referencing it wrong when adding your content.
are you attaching dynamic content before or after you set the contentPath?
k.

Renge
01-19-2006, 05:01 PM
are you attaching dynamic content before or after you set the contentPath?


contentPath is in 2.swf, which loads 1.swf

1.swf has the xml dynamic data

What's strange is that if 1.swf has static content, then 2.swf loads 1.swf and that static content shows up.

Renge
01-19-2006, 10:52 PM
I've provided a screen shot of what I'm looking to do.

Tnx!

flashead
01-20-2006, 01:53 AM
contentPath is in 2.swf, which loads 1.swf

1.swf has the xml dynamic data

What's strange is that if 1.swf has static content, then 2.swf loads 1.swf and that static content shows up.
that didn't exactly answer my question.
what i meant was, are you setting the contentPath, and then attaching the content from xml?
or are you attaching the content from xml and then setting the contentPath?

i'd suggest doing that latter if you aren't already.
otherwise, maybe a file to look at would help. (make sure its flash 7 though, thanks)
k.

Renge
01-20-2006, 06:25 PM
Sorry, I couldn't upload all files together.

So, here's 1.fla (there is one for static content, and one for dynamic xml content).

2.fla will follow.

Tnx!

Renge
01-20-2006, 06:26 PM
Here is 2.fla.

When you've download both zip files, just put all files together in one folder/directory/location.

Tnx!

Renge
01-20-2006, 06:30 PM
So, I left 2.fla accessing the static content swf, which you'll see works when published.

But I need the dynamic content one to work. :)

So, in 2.fla, if you comment out:
scrollpane.contentPath = "1_static.swf";

And then remove comment from:
//scrollpane.contentPath = "1_dynamic_xml.swf";

And republish 2.fla, you'll now see that it no longer works.

hmmmmm....?

Tnx!

Renge
01-20-2006, 07:24 PM
I forgot to respond to flashead's question before, so here goes:

2.fla is where the contentPath is set and that's done first.

contentPath can be set to either 1_static.swf (which was how I had it set on the file I uploaded just before), or it can be set to 2_dynamic_xml.swf (which is how I want this to work, and am having problems with).

I never "attached" the xml, though. The xml is handled in 2_dynamic_xml.fla.

If the way I've set all this to work (2 separate files) is causing a problem, having it all done within 1 file is acceptable, but how to that that, too, is a followup question, then.

Tnx!

Renge
02-02-2006, 10:56 PM
I'm still trying to get 2.swf (has a ScrollPane component) to load in 1.swf (which has XML data dynamically added to a mc).

Help.

tcr
02-03-2006, 02:40 PM
it tends to work if you have a movieclip in the scrollpane fla - this movie clip then calls the dynamic content swf via a loadMovie command inside it.

the problem im having after that is variable referencing -

the movie loads in my scrollpane but just loops.

but the lovely component section hardly gets any traffic :(

flashead
02-06-2006, 04:34 PM
hey renge.
you're using _root. :eek:
that's your problem right there.

as soon as your dynamic swf get's loaded into your other main file, _root becomes the _root of your main file and therefor screws up all your scopes.
it's best to just get out of the habit of using _root altogether.

set up a global scope variable that equals your _root and use that everywhere you'd noramally use _root:
_global.myRoot = this; // on frame 1 of your main timeline.

// then instead of
_root.gotoAndPlay( 5 );

//use
myRoot.gotoAndPlay( 5 );

now, since all your code is already written and it's a bit of a pain to go through and find everywhere you've used _root, you can actually just do a quick fix and add:
this._lockroot = true;

to frame 1 in your main timeline of your dynamic swf. that'll lock the scope and make it work too. but in the future, just don't use _root and you won't have these problems ;)

k.