Loader Component & attachMovie

  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

Hi all

I have an app which takes data from php - MYSQL, loads into flash and now im just displaying it using attachMovie to use an MC from the library..

In this data there is a imageurl string. I want to use the imageurl string as the loader components content path. I have done some tests offline and using something like
Code: [ Select ]
_root.image.contentPath = "images/2.jpg";
Works fine.

Now, getting more complicated and setting the contentPath for multiple dynamicly placed MC's is a little more difficult. I have the loop & displaying all the text nailed. Its just getting the Loader component to play ball.
Code: [ Select ]
_root.itemcontainer["item"+$counter].imageurl.contentPath = this["image"+$counter];
This contains "images/1.jpg"
Code: [ Select ]
this["image"+$counter]
but it just doesn't work. All the Loader components on stage are empty.

Any idea?

Thanks
  • krismeister
  • Graduate
  • Graduate
  • krismeister
  • Posts: 202

Post 3+ Months Ago

Is this correct? You're creating itemcontainer children using attach movie, and each attached movie has a Loader Componnet called imageurl.

From your HTML doc the path "images/1.jpg" is correct?
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

yep, thats correct.

also, changed

Code: [ Select ]
var counter:Number = 0;
... loop bit
_root.itemcontainer["item"+counter].imageurl.contentPath = this["image"+counter];
... end loop
  1. var counter:Number = 0;
  2. ... loop bit
  3. _root.itemcontainer["item"+counter].imageurl.contentPath = this["image"+counter];
  4. ... end loop

as i had $'s everywhere not realising thats PHP syntax :banghead: still doesn't work tho :P

I have this

MC on stage called 'itemcontainer'

loop iteration 1
-MC Attached to 'Itemcontainer' as child called 'item1' (1 being the counter)
-loader component of item's contentpath set.
y coord + 100
end loop

loop iteration 2
--MC Attached to 'Itemcontainer' as child called 'item2' (2 being the counter)
-loader component of item's contentpath set.
y coord + 100
end loop

etc... as the loop goes.

thats the best way i can think of laying it out. I have the placing & setting of fields within each MC right, its just the loader component which doesn't work
  • krismeister
  • Graduate
  • Graduate
  • krismeister
  • Posts: 202

Post 3+ Months Ago

You've set a debug marker on line:
Code: [ Select ]
_root.itemcontainer["item"+$counter].imageurl.contentPath = this["image"+$counter];

and the Loader Component does exist in the inspector at that time?
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

debug marker?

In my library im attaching the MC called 'item' its linkage is 'item' too.
What that code is basically saying is:
Code: [ Select ]
_root.itemcontainer["item"+$counter].imageurl.contentPath = this["image"+$counter];

As Parsed =
_root.itemcontainer.item1.imageurl.contentPath = this.image1;
  1. _root.itemcontainer["item"+$counter].imageurl.contentPath = this["image"+$counter];
  2. As Parsed =
  3. _root.itemcontainer.item1.imageurl.contentPath = this.image1;


make any more sense?... the MC item1, which is attached to itemcontainer, has a loader component on the stage with the instance name of 'imageurl'

any clearer?

my concept works, I can even upload a copy of my php script & .fla if you like. its just the loader component, for some reason i can't set the contentPath like this :?
  • krismeister
  • Graduate
  • Graduate
  • krismeister
  • Posts: 202

Post 3+ Months Ago

Yes I understood you the first time.

What I meant before was breakpoint, sorry for the confusion:
http://livedocs.adobe.com/flash/8/main/ ... 01632.html

The Flash IDE has a very good debugger, which plenty of developers aren't aware of.

I figure it might be something dumb, like the Loader Component isn't initialized yet when you're trying to set contentPath. I can't stand when Flash does stuff like that, but sometimes waiting a frame makes everything work correctly.

Also if you have Firebug installed, you can monitor your NetTraffic to see if for instance the component is trying to download the movie, but some reason from the wrong spot.
  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Posts: 2297
  • Loc: UK - England

Post 3+ Months Ago

Well, just as an update. I gave up on the loader component. I dont have a clue why it wasn't working. I've just resorted to using LoadMovie and a proloader.

Works fine.

Only problem so far is that when I set the MC's width and height (to scale my jpeg) it vanishes off the stage. There is a fix for it, I will post it later when I get home.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

I get the feeling "this" wasn't refering to the object you thought it was.

Nice $variables btw, I do that now & then too. :lol:

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 6 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.