I have some scripts that loads in external jpeg for a flip and match game. Currently, for every 2 cards I have a for loop to call in the image, and after 10 card is load and duplicate, it will go to the 2nd line. If I have 60 cards on the board, that means I need to have duplicate almost 30 sets of coding with the arrangement of card in grid. I know this is not a smart way to do it, can anyone help me on this?
And the bigger problem I think is, the jpeg loaded into the card. I want to load in the last/latest 30 pictures as the card image. Because I will be constantly putting new images into the picture folder.
This is currently how I am doing.
[FONT=monospace] ActionScript Code:
[LEFT][COLOR=#0000ff]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]**var**[/COLOR] i:[COLOR=#0000ff]Number[/COLOR]=[COLOR=#000080]0[/COLOR]; i < [COLOR=#000080]2[/COLOR]; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]**var**[/COLOR] imageRequest:URLRequest=[COLOR=#000000]**new**[/COLOR] URLRequest[COLOR=#000000]([/COLOR][COLOR=#ff0000]"cards/pic9.jpg"[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]**var**[/COLOR] imageLoader:Loader=[COLOR=#000000]**new**[/COLOR] Loader;
imageLoader.[COLOR=#0000ff]load[/COLOR][COLOR=#000000]([/COLOR]imageRequest[COLOR=#000000])[/COLOR];
card=[COLOR=#000000]**new**[/COLOR] Card ;
addChild[COLOR=#000000]([/COLOR]card[COLOR=#000000])[/COLOR];
card.[COLOR=#000080]setType[/COLOR][COLOR=#000000]([/COLOR]imageLoader[COLOR=#000000])[/COLOR];
card.[COLOR=#000080]x[/COLOR]=cardX;
card.[COLOR=#000080]y[/COLOR]=cardY;
cardX+= card.[COLOR=#0000ff]width[/COLOR] + [COLOR=#000080]10[/COLOR];
card.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR],checkCards[COLOR=#000000])[/COLOR];
cardArray.[COLOR=#0000ff]push[/COLOR][COLOR=#000000]([/COLOR]card[COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#0000ff]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]**var**[/COLOR] j:[COLOR=#0000ff]Number[/COLOR]=[COLOR=#000080]0[/COLOR]; j < [COLOR=#000080]2[/COLOR]; j++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]**var**[/COLOR] imageRequest2:URLRequest=[COLOR=#000000]**new**[/COLOR] URLRequest[COLOR=#000000]([/COLOR][COLOR=#ff0000]"cards/pic10.jpg"[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]**var**[/COLOR] imageLoader2:Loader=[COLOR=#000000]**new**[/COLOR] Loader;
imageLoader2.[COLOR=#0000ff]load[/COLOR][COLOR=#000000]([/COLOR]imageRequest2[COLOR=#000000])[/COLOR];
card=[COLOR=#000000]**new**[/COLOR] Card ;
addChild[COLOR=#000000]([/COLOR]card[COLOR=#000000])[/COLOR];
card.[COLOR=#000080]setType[/COLOR][COLOR=#000000]([/COLOR]imageLoader2[COLOR=#000000])[/COLOR];
card.[COLOR=#000080]x[/COLOR]=cardX;
card.[COLOR=#000080]y[/COLOR]=cardY;
cardX+= card.[COLOR=#0000ff]width[/COLOR] + [COLOR=#000080]10[/COLOR];
card.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR],checkCards[COLOR=#000000])[/COLOR];
cardArray.[COLOR=#0000ff]push[/COLOR][COLOR=#000000]([/COLOR]card[COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
_cardX = [COLOR=#000080]45[/COLOR]
_cardY+= _card.[COLOR=#0000ff]height[/COLOR] + [COLOR=#000080]50[/COLOR] [COLOR=#808080]*//next line of cards*[/COLOR]
[COLOR=#808080]*// and after some 20 or 30 cards loaded in...*[/COLOR]
[COLOR=#0000ff]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]**var**[/COLOR] i:[COLOR=#0000ff]Number[/COLOR]=[COLOR=#000080]0[/COLOR]; i < [COLOR=#000080]2[/COLOR]; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]**var**[/COLOR] imageRequest:URLRequest=[COLOR=#000000]**new**[/COLOR] URLRequest[COLOR=#000000]([/COLOR][COLOR=#ff0000]"cards/pic31.jpg"[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]**var**[/COLOR] imageLoader31:Loader=[COLOR=#000000]**new**[/COLOR] Loader;
imageLoader31.[COLOR=#0000ff]load[/COLOR][COLOR=#000000]([/COLOR]imageRequest31[COLOR=#000000])[/COLOR];
card=[COLOR=#000000]**new**[/COLOR] Card ;
addChild[COLOR=#000000]([/COLOR]card[COLOR=#000000])[/COLOR];
card.[COLOR=#000080]setType[/COLOR][COLOR=#000000]([/COLOR]imageLoader31[COLOR=#000000])[/COLOR];
card.[COLOR=#000080]x[/COLOR]=cardX;
card.[COLOR=#000080]y[/COLOR]=cardY;
cardX+= card.[COLOR=#0000ff]width[/COLOR] + [COLOR=#000080]10[/COLOR];
card.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR],checkCards[COLOR=#000000])[/COLOR];
cardArray.[COLOR=#0000ff]push[/COLOR][COLOR=#000000]([/COLOR]card[COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#0000ff]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]**var**[/COLOR] j:[COLOR=#0000ff]Number[/COLOR]=[COLOR=#000080]0[/COLOR]; j < [COLOR=#000080]2[/COLOR]; j++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]**var**[/COLOR] imageRequest32:URLRequest=[COLOR=#000000]**new**[/COLOR] URLRequest[COLOR=#000000]([/COLOR][COLOR=#ff0000]"cards/pic32.jpg"[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]**var**[/COLOR] imageLoader32:Loader=[COLOR=#000000]**new**[/COLOR] Loader;
imageLoader32.[COLOR=#0000ff]load[/COLOR][COLOR=#000000]([/COLOR]imageRequest32[COLOR=#000000])[/COLOR];
card=[COLOR=#000000]**new**[/COLOR] Card ;
addChild[COLOR=#000000]([/COLOR]card[COLOR=#000000])[/COLOR];
card.[COLOR=#000080]setType[/COLOR][COLOR=#000000]([/COLOR]imageLoader2[COLOR=#000000])[/COLOR];
card.[COLOR=#000080]x[/COLOR]=cardX;
card.[COLOR=#000080]y[/COLOR]=cardY;
cardX+= card.[COLOR=#0000ff]width[/COLOR] + [COLOR=#000080]10[/COLOR];
card.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR],checkCards[COLOR=#000000])[/COLOR];
cardArray.[COLOR=#0000ff]push[/COLOR][COLOR=#000000]([/COLOR]card[COLOR=#000000])[/COLOR];
[COLOR=#000000]}
//end with the latest/last card
[/COLOR][/LEFT]
[/FONT]
[FONT=monospace][LEFT]
[/LEFT]
[/FONT]