Loader Component & attachMovie

  • Nucleo
  • SausagePorkPie
  • Mastermind
  • User avatar
  • Joined: Aug 16, 2003
  • Posts: 2297
  • Loc: UK - England
  • Status: Offline

Post June 24th, 2007, 9:26 am

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
Codebuddies - Website Development Resource
|INCLUDE(), INCLUDE_ONCE(), REQUIRE() IN PHP | - / - |MICROSOFT CRM 4.0 ONCLICK EVENT WITHIN FORM |
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post June 24th, 2007, 9:26 am

  • krismeister
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Oct 21, 2006
  • Posts: 202
  • Status: Offline

Post June 25th, 2007, 7:45 am

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
  • Joined: Aug 16, 2003
  • Posts: 2297
  • Loc: UK - England
  • Status: Offline

Post June 25th, 2007, 9:26 am

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
Codebuddies - Website Development Resource
|INCLUDE(), INCLUDE_ONCE(), REQUIRE() IN PHP | - / - |MICROSOFT CRM 4.0 ONCLICK EVENT WITHIN FORM |
  • krismeister
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Oct 21, 2006
  • Posts: 202
  • Status: Offline

Post June 25th, 2007, 10:23 am

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
  • Joined: Aug 16, 2003
  • Posts: 2297
  • Loc: UK - England
  • Status: Offline

Post June 25th, 2007, 2:36 pm

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 :?
Codebuddies - Website Development Resource
|INCLUDE(), INCLUDE_ONCE(), REQUIRE() IN PHP | - / - |MICROSOFT CRM 4.0 ONCLICK EVENT WITHIN FORM |
  • krismeister
  • Graduate
  • Graduate
  • No Avatar
  • Joined: Oct 21, 2006
  • Posts: 202
  • Status: Offline

Post June 25th, 2007, 6:26 pm

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
  • Joined: Aug 16, 2003
  • Posts: 2297
  • Loc: UK - England
  • Status: Offline

Post June 29th, 2007, 4:56 am

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.
Codebuddies - Website Development Resource
|INCLUDE(), INCLUDE_ONCE(), REQUIRE() IN PHP | - / - |MICROSOFT CRM 4.0 ONCLICK EVENT WITHIN FORM |
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post June 29th, 2007, 5:56 am

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:
Strong with this one, the sudo is.

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 42 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
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.