Page 1 of 1

Little help with csv please

PostPosted: Tue Dec 03, 2013 1:46 pm
by xum
This is probably a basic thing just my logic is broken but I can’t figure it out. Sorry.
I’m working on creating a catalog of my …stuff.
I will have a “list” layout which I will generate from a database: for each item, a sprite with a thumbnail picture than item name ,like so:
thmbn 1, item1
thmbn 2, item 2
thmbn n, item n

I created a variable. When I input variable N(than click button) it creates line in the list layout:
thmbn N (sprite is loading from csv file At(“thmbn” variable).jpg.)
it’s all good.
Click button again creates new list item underneath. good.
problem:
When I change variable and click, it displays new list item with correct thmbn.jpg. but changes thmbn.jpg of all other items already displayed.

I tried using local variables but.. same result. How can I keep .jpg already displayed unchanged. Thank you!
P.S. love love love Construct2!

Re: Little help with csv please

PostPosted: Tue Dec 03, 2013 1:58 pm
by LittleStain
I guess you are using load from url, so probably you are loading all jpg's into the same sprite and the same frame of the sprite like in this topic:

load from url

Re: Little help with csv please

PostPosted: Tue Dec 03, 2013 6:31 pm
by xum
Hey, thanks a lot for the speedy response! I did load all the jpg's in separate frames like in your example, which is great. But I still have the same problem: all the displayed list items show the last thmbn.jpg I loaded (the last frame). I know what my problem is: it's the logic. All the create thmbn happen in the same event (on different button clicks) so the all the images reset to the last one.
I have to exclude the existing thumbnails from the loop. Or prevent the resetting by affecting only the current create of thmbn.
Can you point me into the right direction, please? Thanks in advance!

Re: Little help with csv please

PostPosted: Tue Dec 03, 2013 6:48 pm
by LittleStain
If you set the frame in a subevent of the creation event, only the created instance will be affected.

If this doesn't work you should read up on picking instances in the FAQ-thread on this forum.

I don't know how you have your events set up, so this is all I can do without seeing your capx.

Re: Little help with csv please

PostPosted: Tue Dec 03, 2013 8:01 pm
by xum
[QUOTE=LittleStain] If you set the frame in a subevent of the creation event, only the created instance will be affected.

What is this magic? It worked! I don't really understand how, but it did. So easy. Obviously I have a lot to learn about subevents and C2. Thanks a million!