PDA

View Full Version : FLASH / PHP / SQL / AS I have lost my way


pure
10-18-2002, 01:07 PM
Hi all,

I have created a semi dynamic flash site getting content from a SQL db via PHP.

It was working until instead of calling an external url I wanted my submenu selections to load the dynamic data into the flash file.

So I load my menu, submenu content and when a selection is made from the submenu the data is loaded and loaded as needed. Could someone pleasse have a look at my code and see where I have gone awry.

I have got so far with help from MusicMan at Flashkit

*********************************

// Frame 1
stop ();
loadVariables ("http://prototype.emarket2.com/admin/load_set.php", "data");
// file is text below - too save your time
// data is the targetted movie clip
&menu1=Home&menu2=Corporate&menu3=Products&menu4=Clients&menu5=Location&numMenus=5&menu1Links=3&menu1Link1Title=Home 1&menu1Link1Url=http://www.flashkit.com&menu1Link2Title=Home 2&menu1Link2Url=http://prototype.emarket2.com/Craig_Development/var.php?id=37&menu1Link3Title=Home 3&menu1Link3Url=http://prototype.emarket2.com/Craig_Development/var.php?id=38&&menu2Links=3&menu2Link1Title=Corporate 1&menu2Link1Url=gotoAndStop,30&menu2Link2Title=Corporate 2&menu2Link2Url=&menu2Link3Title=Corporate 3&menu2Link3Url=&&menu3Links=5&menu3Link2Title=Product 2&menu3Link2Url=&menu3Link3Title=Product 3&menu3Link3Url=&menu3Link4Title=Product 1&menu3Link4Url=&menu3Link5Title=Product 4&menu3Link5Url=&menu3Link6Title=Product 5&menu3Link6Url=&&menu4Links=2&menu4Link1Title=Clients 1&menu4Link1Url=fgshrtsh&menu4Link2Title=Clients 2&menu4Link2Url=fghrsthr&&menu5Links=2&menu5Link1Title=Location 1&menu5Link1Url=&menu5Link2Title=Yemis Location&menu5Link2Url=&&


// Frame 2
play()

// Frame 3
stop ();
with (data) {
for (i=1; i<=numMenus; i++) {
numLinks = (eval("menu"+i+"Links"))*1;
set ("_root.menu"+i+".numLinks", numLinks);
for (j=1; j<=numLinks; j++) {
theTitle = eval("menu"+i+"Link"+j+"Title");
set ("_root.menu"+i+".link"+j+".theTitle", theTitle);
theLink = eval("menu"+i+"Link"+j+"Url");
if(thelink.indexOf("http") == 0)
set ("_root.menu"+i+".link"+j+".theLink", theLink);
else

{ f = theLink.split(",");
set ("link1"+i+".func", f[0]);
set ("link1"+i+".fnarg", f[1]);
}
}}
}


**************************************************
************************
//The "data" movie clip has the following action :

onClipEvent (data) {
tellTarget ("_root") {
nextframe ();
}
for (i=1; i<=numMenus; i++) {
numLinks = (eval("menu"+i+"Links"))*1;
set ("_root.menu"+i+".numLinks", numLinks);

}
}
**************************************************
************************
//I have 5 movie clips each is a menu named sequentially //menu1, menu2 ...,menu5

//Inside menu1

// Frame1

stop ();
direction = 0;
openPos = _y
originalPos = _y - (getProperty("link1", _height)*numLinks) - 20;
for (i=2; i<=numLinks; i++) {
duplicateMovieClip ("link1", "link"+i, i);
linkPos = getProperty("link"+i, _y)+(getProperty("link"+i, _height)*(i-1)-1);
setProperty ("link"+i, _y, linkPos);
}
setProperty ("menuBg", _y, getProperty("menuBg", _y)+(getProperty("link1", _height)*numLinks)+5);
setProperty (this, _y, originalPos);

// Frame2

oldPos = _y;
newPos = oldPos+(direction*10);
if (direction==-1 and newPos>=originalPos) {
setProperty (this, _y, newPos);
}
if (direction==1 and newPos<=openPos) {
setProperty (this, _y, newPos);
}

// Frame3
gotoAndPlay ( 2 );

//Inside menu1 aand all the other menus 2-5
// is another movie clip called - link1

// inside link1 are two objects a button called - link which //has the following action-

on (rollOver) {
tellTarget ("../") {
direction = 1;
play ();
}
}
on (rollOut) {
tellTarget ("../") {
direction = -1;
play ();
}
}
on (release) {
if (typeof (this.func) != 'undefined') {
_root[this.func](this.fnarg);
} else {
getURL (theLink);
}
}

//and a dynamic //text field called - theTitle

// an older online version is at http://prototype.emarket2.com/Craig_Development/2v.swf

looking forward to any help you can offer if not I understand and appreciate the help you have given me.

If you would like to view the fla just let me know

Kindest

jimburton
10-18-2002, 06:22 PM
whoa there mr pure! that's a bit too much info to start with, plus F4 syntax gives me the vapours... :) maybe people will comment on and fix your code, but my advice would be that the first thing you need to do is to try to work out which bit isn't working - at what point does it fall down - and provide that code only for help/comments.

Do this by using the debugger to check on the data that comes in to the movie (to do that you might have to change loadVariables statements etc to absolute http:// links and look at it in test mode) and follow the logical flow of the movie until you get to a point where it's not what you expect...good luck with it

pure
10-21-2002, 01:53 PM
Thanks Jim,

using that logic, which I should have employed initially I have found that my functions and arguments are not being defined. I can go from there.

Thank You
Kindest