Hi
Recently i've been assigned to be the WebDesigner of my new JOB, but meanwhile i've been fighting with the normal problems, OTHER guy did the SITE! eheheh
And resuming my problems are:
a) when I update my XML file for a menu, when i copy it to the server.... in the web it appears the same name as it has been for ages.... i've read that it ill refresh.... but i would like a confirmation! Can you help me with that?
b) I had to do a new banner, and include a older one made by the other... guy... When I am seeing the SWF in my computer, no problem... when i put it on dreamweaver... i doesnt show the supposed SWF...
I used in the timeline
loadMovie("1.swf", "empty_mc");
And it works, except on dreamweaver!
Please helpp....
Thank you
Best regards
Ricardo Lourenço
Lisbon, Portugal
You mentioned loadMovie so I'm assuming you're using ActionScript 2.0?
Cache is sometimes hard to deal with. Most likely your browser is caching the old XML and when you upload the new XML it doesn't get it because it already has a cached version. To get around it, add a random argument to the end of the request for the XML so the browser will think the request is unique every time.
e.g.
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = someParserFunction;
// send a random number to the load string that won't
// affect the XML loaded at all
myXML.load("my.xml?r=" + Math.round(Math.random() * 99999));
The XML cache issue should go away.
On the banner, what version of Dreamweaver? How are you viewing it, such as are you viewing it in Live View on a modern version of DW with a test server or are you just testing locally in the WYSIWYG editor?
Hi Thank you for your answser!
Regarding the AS, yup it is 2.0... is is easier and faster... ![]()
And yes the cache problem...
But where do I put it?
In the *.AS or the Actionscript on my FLA file?
Regarding the banner, i'm using Dreamweaver CS4 and i havent put it online! I don use LIVE VIEW... always see in Browser preview!
And LOCAL...
What do you think I can do?
Thank you a lot... for your pacience!
best regards
The only code you've posted so far is "loadMovie('1.swf','empty_mc');". Is that literally what you're doing?
As far as the XML goes, please post your code to load the XML so I can help you update it for cache friendliness.
Note that when testing locally you can get into sandbox and domain violations very easily. The best thing to do is test in your desired context when you're a beginner. When you want to test, upload the files to your website where nobody else can see them for testing. Many of the issues you'll get into running the content locally will not happen online so that will remove a lot of unnecessary complexity.
Once again! Thank you!
Relating to the last part! I understand... I've done that! eheheh
Regarding the REFRESH and CaCHING...
The objective is a submenu that works with links and names in the XML!
i have tree documents:
the XML File
Has the names and links! no worries HERE!
the FLa file
divided in the frames:
action layer:
var treeListener:Object = new Object();
treeListener.target = tree;
treeListener.opened = undefined;
treeListener.open_next = undefined;
/* a node in the tree has been selected */
treeListener.change = function(evt:Object) {
var node = evt.target.selectedItem;
var is_open = evt.target.getIsOpen(node);
var is_branch = evt.target.getIsBranch(node);
var node_to_close = node.getBrotherChilds(this.target);
// close the opened node first
if (node.attributes.value) {
getURL(node.attributes.value);
}
if (this.target.getIsOpen(node_to_close) and this.target.getIsBranch(node_to_close)) {
this.target.setIsOpen(node_to_close, false, true, true);
this.open_next = node;
} else {
if (is_branch) {
this.target.setIsOpen(node, true, true, true);
} else {
this.target.selectedNode = node;
this.target.dispatchEvent({type:"click", target:evt.target});
}
this.open_next = undefined;
}
};
treeListener.closeNode = function(node:XMLNode) {
for (var a in node.childNodes) {
if (this.target.getIsOpen(node.childNodes[a])) {
this.closeNode(node.childNodes[a]);
}
}
this.target.setIsOpen(node, false, false);
};
treeListener.nodeClose = function(evt:Object) {
this.closeNode(evt.node);
if (this.open_next != undefined and evt.target.getIsBranch(this.open_next)) {
evt.target.setIsOpen(this.open_next, true, true, true);
} else {
evt.target.selectedNode = this.open_next;
this.target.dispatchEvent({type:"click", target:evt.target});
this.open_next = undefined;
}
};
treeListener.nodeOpen = function(evt:Object) {
evt.target.selectedNode = evt.node;
};
// set out listeners for the menu
tree.addEventListener('change', treeListener);
tree.addEventListener('nodeClose', treeListener);
tree.addEventListener('nodeOpen', treeListener);
the PROTOYPE LAYER
System.useCodepage = true;
XMLNode.prototype.isChildNodeOf = function(targetParent:XMLNode) {
var ret:Boolean = false;
var myParent:XMLNode = this;
while (myParent.parentNode != undefined) {
if (myParent == targetParent) {
ret = true;
break;
}
myParent = myParent.parentNode;
}
return ret;
};
/**
* Return a list of sibling nodes of the parent node
*/
XMLNode.prototype.getBrotherChilds = function(cTree:mx.controls.Tree) {
var parent = this.parentNode;
for (var a = 0; a<parent.childNodes.length; a++) {
if (parent.childNodes[a] != this and cTree.getIsOpen(parent.childNodes[a])) {
return parent.childNodes[a];
}
}
return undefined;
};
var menu:XML = new XML();
menu.ignoreWhite = true;
menu.onLoad = someParserFunction;
// send a random number to the load string that won't
// affect the XML loaded at all
menu.load("menu.xml?r=" + Math.round(Math.random() * 99999));
THE STYLES LAYER
// get the menu XML
this.xml_conn.trigger();
// customize tree styles
this.tree.setStyle("fontFamily", "Verdana");
this.tree.setStyle("fontSize", 9);
//this.tree.setStyle("fontSize", this.test_text.getTextFormat().size);
this.tree.setStyle("embedFonts", this.test_text.embedFonts);
//this.tree.setStyle("fontWeight", this.test_text.getTextFormat().bold ? "bold" : "normal");
this.tree.setStyle("depthColors", [0xEFEACF, 0xffffff, 0xefefef, 0xefefef, 0xefefef, 0xefefef]);
this.tree.setStyle("backgroundColor", 0xFFFFFF);
this.tree.setStyle("borderStyle", "none");
this.tree.setStyle("color", 0x42453E);
this.tree.setStyle("textIndent", 0);
this.tree.setStyle("indentation", 0);
this.tree.setStyle("rollOverColor", 0xF1F1F1);
this.tree.setStyle("selectionColor", 0xefefef);
this.tree.setStyle("selectionDuration", 0);
this.tree.setStyle("textRollOverColor", 0xFF9900);
this.tree.setStyle("textSelectedColor", 0xFF9900);
this.tree.setStyle("defaultLeafIcon", "nullicon");
this.tree.setStyle("folderOpenIcon", "nullicon");
this.tree.setStyle("folderClosedIcon", "nullicon");
this.tree.setStyle("disclosureClosedIcon", "nullicon");
this.tree.setStyle("disclosureOpenIcon", "nullicon");
this.tree.vScrollPolicy = 'off';
// set a custom cell renderer for the Tree
// See treecellrenderer.as file for details
this.tree.cellRenderer = 'customTreeRow';
// These 2 styles will be used by the
// custom cellrenderer
this.tree.setStyle("lineColor", 0xEAD67A);
this.tree.setStyle("lineAlpha", 100);
The AS file:
class treecellrenderer extends mx.controls.treeclasses.TreeRow
{
var owner; // the row that contains this cell
var listOwner; // the List/grid/tree that contains this cell
function treecellrenderer(){
}
function createChildren(){
super.createChildren();
}
function setValue(node, state){
super.setValue(node, state)
var lineColor:Number = listOwner.getStyle('lineColor')
var indent = ((listOwner.getNodeDepth(owner.node))+3) * getStyle("indentation");
clear();
if( owner.node != undefined ){
beginFill( lineColor , listOwner.getStyle('lineAlpha') || 100);
drawRect( -indent, Math.ceil(owner.height)-.25, listOwner.width, Math.ceil(owner.height)+.25)
endFill();
}
}
function disclosurePress(){
super.disclosurePress();
}
function size(){
super.size();
}
function setColor(color:Number):Void
{
cell.setColor(color)
}
}
REGARDING THE BANNER...
I've tried with online!
and the online CODE I HAVE THERE IS :
loadMovie('1.swf','empty_mc');
So it can get the another SWF - but i doesn't!
![]()
THANK 's for you pacience! ![]()
A lot of code but not really what I'm looking for. It's important to know I'm not being literal when I say things like:
menu.onLoad = someParserFunction;
That simply means I don't know what you're doing in your project and to point the onLoad to a function that will "do something" with the XML once it's loaded.
You hadn't mentioned the XML was for a TreeView component. All you're going to want to do is, after the XML is loaded, set the .dataProvider of the component to the XML you just loaded. There's a function being fired off in that class that should handle that for you which is:
// get the menu XML
this.xml_conn.trigger();
Find the code for xml_conn and find the trigger() method. There should be something in there that's not only loading XML but is also setting the dataProvider of "this.tree". When you find that you can paste the code or just adjust it like I mentioned above by adding the random number to it.
As for loading the 1.swf, your target needs to exist. You specified 'empty_mc' as the target. If that's not a MovieClip already on the stage then you'll need to create it.
e.g.:
this.createEmptyMovieClip('empty_mc',this.getNextHighestDepth());
loadMovie('1.swf','empty_mc');
North America
Europe, Middle East and Africa
Asia Pacific