| Todd Coulson 2005-12-16, 5:45 pm |
| <quote>That's some nice work </quote>
Thanks a ton, it is about 3 weeks worth of work, but we don't want
Christmas to pass without getting it out to our clients. Also Graeme,
thanks for replying.
=20
<quote>Anyways, flush doesn't work on server side SO's, </quote>
Good to know, I suspected that after trying them and getting no real
results.
=20
<quote>1. setting the data in the SO, so you can get that onSync</quote>
The data gets updated directly from my flash fla. I am saving a
reference to a "UserManager" class that Peldi created, and I added onto.
Then the pen updates the data property of the shared object like this:
<code>
pen_mc.onRelease=3Dfunction(){
if (scrollBTN_mc.ani=3D=3Dfalse){/* a flag I created to see if =
the
scroll is out (you cant post unless the scroll is out)*/
this.ref.data.penCk=3Dthis.ref.owner.getMyUserID();//set
the pen owner to the current user
this.addProp("_x", 800, 20);//animate the pen away - this
is another class I created
this.onEnterFrame=3Dfunction(){
this.ref.data.pen_mc_x=3Dthis._x;//as long as
animation runs, update the data for pen location
//this.ref.flush();//I took out the flush because
it wasn't working
}
wholeGlass.restartTime();//update the hourglass
wholeGlass.top_mc.onEnterFrame=3Dfunction(){
=
this.ref.data.top_mc_yscale=3Dthis._yscale;//update
hourglass in SO
=20
this.ref.data.bottom_mc_yscale=3Dthis._parent.bottom_mc._yscale;
=20
this.ref.data.sand=3Dthis._parent.sand._currentframe;
}
this.ref.data.allow=3Dfalse;//update variable to check if
pen is taken out
this._parent.penVisible(true);
Selection.setFocus("addBox_mc.story_txt")//put focus on
the submit textbox
}else{
this.gotoAndStop("scrollMsg");//send error message if
scroll is not out.
}
}
</code>
=20
2. setting the data in the DB, which in turn created an onSync? not sure
how that works, more info maybe?
The db is updating as long as the SO is updated. This is why I suspect
it is not a DB problem, because the trace action isn't even being hit,
which in turn means the db won't get called. Here is my onSync
statement inside the userManager class:
<code>
a_so.onSync=3Dfunction( list ):Void{ =20
_root.pen_mc.ref=3Dthis;//make a reference to the sync inside =
the
pen
_root.wholeGlass.top_mc.ref=3Dthis;//make a reference to the =
sync
inside the hourglass
this.tmpCk=3Dthis.data.allow;/*make a flag to isolate the moment
the user take the pen and the moment the user returns the pen to its
original position*/
this.cache=3D"?cacheKiller=3D" + new Date().getTime();//kill =
cache
to make sure db updates without old data.
this.traceVar=3D"tmpCk: "+tmpCk+" prevCk: "+prevCk;
_root.trace_list.addItem({label:this.traceVar});//message to
listbox for feedback
if ((tmpCk!=3DprevCk && tmpCk=3D=3Dtrue) ||(tmpCk=3D=3Dundefined =
&&
prevCk=3D=3Dundefined)){/* if temp is not equal to prev then we know the =
pen
is being taken away or being put back*/
_root.currently._visible=3Dfalse;/*I know I hate =
references
to root, but I had to do it, this will turn a clip on or off to let
people know the pen is out*/
=20
_root.myVars_lv.load("http://www.myhaleypro.com/um/story.php"+this.cache
);//call the db
_root.allowPenActions();//let the pen be clickable again.
}else if (tmpCk!=3DprevCk && tmpCk=3D=3Dfalse){//pen is being =
taken
away.
_root.pen_mc.enabled=3Dfalse;//do not let people click =
the
pen=20
}
this.prevCk=3Dthis.data.allow;//set previous flag for =
comparison.
for (var i in list){
if (list[i].code=3D=3D"change" || =
list[i].code=3D=3D"reject"){
this.owner.onChange();//handles some other
updates, calls a function in userManager
break;
}
}
}
a_so.connect(m_nc);
</code>
3. receiving the onSync and dealing with whatever change there is
See onSync above.
4. getting the new data to show in the scroll after submitting it.
addBox_mc.allow_mc.onRelease=3Dfunction(){
if (this._parent.story_txt.text!=3D"" &&
this._parent.story_txt.text!=3D"Please enter text here."){
//if the text isn't blank I can get text from the fields
return_lv.email=3DemailVar;// global variable from the
first login
return_lv.myname=3DnameVar;// global variable from the
first login
str=3DaddBox_mc.story_txt.text;//take the text of the
story.
str=3Dstr.obscene();//function check to not allow for =
foul
words
return_lv.story=3Dstr.escapeToHTML();//make sure the text
is characters that php will allow.
cache=3D"?cacheKiller=3D" + new Date().getTime();// kill
cache
=20
return_lv.sendAndLoad("http://www.myhaleypro.com/um/post.php" + cache,
eval_lv, "POST");//call db
/*eval_lv when loaded calls the pen function into
existence (that function is the first function up above)*/ =20
}else{
this._parent.story_txt.text=3D"Please enter text here."
}
}
=20
Hope that explains things more. My whole code is 8megs large and is
located at:
http://tc.haleypro.com/holiday.zip
feel free to dissect it.
=20
Thanks,=20
Todd Coulson
Haley Productions
604 E. Baltimore Pk.
Media, PA 19063
610-892-7970
http://www.haleypro.com
=20
=20
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
|