For example, it started off using an xml list to display certain images but I found it necessary to draw info from the database and pass some variables in the querystring to change the source of the images in the movie depending on which client is clicked.
Here is the problem.
I have tweaked the code and it should work fine - and sometimes it does. But in the case where client A has 3 projects, sometimes it displays the 3 different images, or sometime it displays just the last image 3 times. When all 3 are the same, sometimes I see that it loads all 3 images but then it's quickly overwritten with the last image.
The URL for this is at : http://12.162.169.138/clients.php?client=29
The URL for the actual SWF is http://12.162.169.138/portfolio4.swf?client=29&pic=10&pic=33&pic=36
-----------------------------------------------------------------
Here is the code that puts the pictures into the movie :
Expand|Select|Wrap|Line Numbers
- onClipEvent (load) {
- ogy = _y;
- //if (thenum>0) {
- thurl = this._url;
- var fulllist = thurl;
- //thurl = _parent.toadd+lurl;
- var picarr = thurl.split("&pic=");
- alen = picarr.length;
- for (var i = 1; i<alen; i++) {
- loadMovie(toadd+"pics/"+picarr[i]+".jpg", pic.pic2);
- }
- //loadMovie(toadd+"pics/"+_parent.specs.attributes.name+".jpg", pic.pic2);
- //}
- }
- onClipEvent (enterFrame) {
- if (_parent.nav == thenum) {
- gotoy = _parent.stageheight/2-34;
- if (!done) {
- gotor = random(30)-random(30);
- done = true;
- }
- } else if (_parent.nav>thenum) {
- done = false;
- gotoy = -500;
- } else if (_parent.nav<thenum && _parent.nav != 0) {
- gotoy = _parent.stageheight+500;
- done = false;
- } else {
- gotoy = -600;
- done = false;
- }
- lefty = gotoy-_y;
- _y += lefty/4;
- leftr = gotor-_rotation;
- //_rotation += leftr/4;
- }
- onClipEvent (mouseUp) {
- //lurl=_parent.lurl;
- lurl = _parent.toadd+lurl;
- //getURL("pics/"+thenum+"d.jpg", "detail");
- getURL(lurl, "detail");
- }
-----------------------------------------------------------------
Here is the code that makes the side menu :
Expand|Select|Wrap|Line Numbers
- stop();
- nav=1;
- stageheight = 300;
- toadd = "";
- menuxml = new XML();
- myURL = this._url;
- var picarr = myURL.split("&pic=");
- //myPos = myURL.lastIndexOf("?");
- //client = myURL.substring(myPos,myURL.length);
- //this returns the querystring elements - you can now split these using split
- var client1 = picarr[0];
- var clientarr = client1.split("=");
- var client = clientarr[1];
- menuxml.load(toadd+"xml/"+client+".xml");
- menuxml.ignoreWhite = true;
- menuxml.onLoad = function(success) {
- if (success) {
- maxnum = menuxml.firstChild.childNodes.length;
- for (n=0; n<maxnum; n++) {
- specs = menuxml.firstChild.childNodes[n];
- //menu
- duplicateMovieClip(clip0, "clip"+(n+1), n);
- menuclip = eval("clip"+(n+1));
- menuclip.h = stageheight/maxnum;
- menuclip._y = 20*n;
- menuclip.thetitle = specs.attributes.name;
- menuclip.thecaption = specs.attributes.caption;
- menuclip.theurl = specs.attributes.url;
- //menuclip.thetarget = specs.attributes.target;
- menuclip.thenum = n+1;
- //pic
- duplicateMovieClip(pic0, "pic"+(n+1), n+100);
- picclip = eval("pic"+(n+1));
- //picclip = eval("pic"+specs.attributes.name);
- //picclip.thetitle = specs.attributes.name;
- //picclip.thecaption = specs.attributes.caption;
- picclip.lurl = specs.attributes.url;
- picclip.thenum = n+1;
- play();
- }
- clip0._visible = false;
- pic0._visible = false;
- }
- };
I've tried also changing the following code in the code that's attached to the actual pic movie.
Expand|Select|Wrap|Line Numbers
- for (var i = 1; i < alen; i++) {
- loadMovie(toadd+"pics/"+picarr[i]+".jpg", pic.pic2);
- }
Expand|Select|Wrap|Line Numbers
- oadMovie(toadd+"pics/"+picarr[1]+".jpg", pic.pic2);
- for (var i = 2; i < alen; i++) {
- duplicateMovieClip(pic, "pic"+i, i);
- eval("pic"+i).loadMovie(toadd+"pics/"+picarr[i]+".jpg", i);
- }