XML

I am trying to Load a title and a description through XML. The example we have looks like this:

<![CDATA[
float head
– 2008
]]>

But looking at this (and the Flash file) – I can not tell how to distinguish between two text fields.

Advertisements

UPdate

So I posted my new bluedawg site live, But I had several problems combining the action script we have learned with time line navigation. So in the end I had to do it the way I knew how instead of using the new stuff we have learned – especially since it’s so hard to get help.

Pest_Patrol_Demo Updated

Needs perhapse some Arrays? Will have to do some experimenting.

Vodpod videos no longer available.

import com.greensock.TweenLite;
import com.greensock.easing.*;

bg.sun.play();
inst_mc.play();

var cultChild:Boolean = false;
var spray1Child:Boolean = false;
var beerChild:Boolean = false;
var bugChild:Boolean = false;
var spray2Child:Boolean = false;
var trapChild:Boolean = false;

var cult:MovieClip = new Cult();
var spray1:MovieClip = new sprayBtl1();
var beer:MovieClip = new Beer();
var lb:MovieClip = new ladyBugs();
var lb2:MovieClip = new ladyBugs();
var spray2:MovieClip = new sprayBtl();
var trap:MovieClip = new Trap_mc();

drop1.visible = false;
drop2.visible = false;
drop3.visible = false;
drop4.visible = false;
drop5.visible = false;
drop6.visible = false;
drop7.visible = false;
groundhog.visible=false;
bunny.visible=false;
hose.visible = false;

dogBtn.buttonMode=true;
cultBtn.buttonMode=true;
btn1.buttonMode=true;
btn2.buttonMode=true;
btn3.buttonMode=true;
btn4.buttonMode=true;
btn5.buttonMode=true;
btn6.buttonMode=true;
btn7.buttonMode=true;
btn8.buttonMode=true;

function resetWeeds(evt:Event):void {
weed1.gotoAndStop(“grow”);
weed2.gotoAndStop(“grow”);
weed3.gotoAndStop(“grow”);
weed4.gotoAndStop(“grow”);
}

function resetSlugs(evt:Event):void {
slug1.gotoAndStop(“start”);
slug2.gotoAndStop(“start”);
slug3.gotoAndStop(“start”);
slug4.gotoAndStop(“start”);
slug5.gotoAndStop(“start”);
slug6.gotoAndStop(“start”);
slug1.x = 917;
slug2.x = 984;
slug3.x = 1070;
slug4.x = -20;
slug5.x = -96;
slug6.x = -177;
}

function helpWin(evt:MouseEvent):void {
inst_mc.visible=true;
inst_mc.play();
}

groundhog.addEventListener(MouseEvent.CLICK, relocateWin);

drop1.addEventListener(MouseEvent.CLICK, onClickDrop1);
drop2.addEventListener(MouseEvent.CLICK, onClickDrop2);
drop3.addEventListener(MouseEvent.CLICK, onClickDrop3);
drop4.addEventListener(MouseEvent.CLICK, onClickDrop4);
drop5.addEventListener(MouseEvent.CLICK, onClickDrop5);
drop6.addEventListener(MouseEvent.CLICK, onClickDrop6);
drop7.addEventListener(MouseEvent.CLICK, onClickDrop7);
btn1.addEventListener(MouseEvent.CLICK, resetWeeds);
btn2.addEventListener(MouseEvent.CLICK, playAphids);
btn3.addEventListener(MouseEvent.CLICK, onClickBeetles);
btn4.addEventListener(MouseEvent.CLICK, playSlugs);
btn4.addEventListener(MouseEvent.CLICK, resetSlugs);
btn5.addEventListener(MouseEvent.CLICK, onClickCrowFly);
btn6.addEventListener(MouseEvent.CLICK, onClickBunny);
btn7.addEventListener(MouseEvent.CLICK, onClickDeer);
btn8.addEventListener(MouseEvent.CLICK, onClickGH);

cultBtn.addEventListener(MouseEvent.CLICK, onClickCult);
beerBtn.addEventListener(MouseEvent.CLICK, onClickBeer);
LBBtn.addEventListener(MouseEvent.CLICK, onClickLB);
spray1Btn.addEventListener(MouseEvent.CLICK, onClickSpray1);
spray2Btn.addEventListener(MouseEvent.CLICK, onClickSpray2);
hose_btn1.addEventListener(MouseEvent.CLICK, onClickHose1);
hose.addEventListener(MouseEvent.CLICK, onClickDeer);
scarecrow_btn.addEventListener(MouseEvent.MOUSE_DOWN, onSCDown);
hose.addEventListener(MouseEvent.MOUSE_DOWN, onHoseDown);
hose.addEventListener(MouseEvent.MOUSE_UP, onHoseUp);
scarecrow.addEventListener(MouseEvent.ROLL_OUT, onSCOut);
dog.addEventListener(MouseEvent.CLICK, onClickDog);
dogBtn.addEventListener(MouseEvent.CLICK, onClickDog);
relocateNavBtn.addEventListener(MouseEvent.CLICK, trapGH);
HelpBtn.addEventListener(MouseEvent.CLICK,helpWin);

//BUTTONS

cultBtn.addEventListener(MouseEvent.MOUSE_OVER, onOver);
cultBtn.addEventListener(MouseEvent.MOUSE_OUT, onOut);
spray1Btn.addEventListener(MouseEvent.MOUSE_OVER, onOver);
spray1Btn.addEventListener(MouseEvent.MOUSE_OUT, onOut);
beerBtn.addEventListener(MouseEvent.MOUSE_OVER, onOver);
beerBtn.addEventListener(MouseEvent.MOUSE_OUT, onOut);
LBBtn.addEventListener(MouseEvent.MOUSE_OVER, onOver);
LBBtn.addEventListener(MouseEvent.MOUSE_OUT, onOut);
spray2Btn.addEventListener(MouseEvent.MOUSE_OVER, onOver);
spray2Btn.addEventListener(MouseEvent.MOUSE_OUT, onOut);
scarecrow_btn.addEventListener(MouseEvent.MOUSE_OVER, onOver);
scarecrow_btn.addEventListener(MouseEvent.MOUSE_OUT, onOut);
dogBtn.addEventListener(MouseEvent.MOUSE_OVER, onOver);
dogBtn.addEventListener(MouseEvent.MOUSE_OUT, onOut);
hose_btn1.addEventListener(MouseEvent.MOUSE_OVER, onOver);
hose_btn1.addEventListener(MouseEvent.MOUSE_OUT, onOut);
relocateNavBtn.addEventListener(MouseEvent.MOUSE_OVER, onOver);
relocateNavBtn.addEventListener(MouseEvent.MOUSE_OUT, onOut);

function onOver(evt:MouseEvent):void {
evt.currentTarget.gotoAndStop(“over”);
}

function onOut(evt:MouseEvent):void {
evt.currentTarget.gotoAndStop(“out”);
}

function onClickCult(evt:MouseEvent):void {
drop1.visible = true;
cultChild = true;
inst_mc.visible = false;
addChild(cult);
addEventListener (Event.ENTER_FRAME, onLoopCult);
function onLoopCult(evt:Event):void {
cult.x = mouseX+30;
cult.y = mouseY
}
}

function onClickBeetles(evt:MouseEvent):void {
addEventListener(Event.ENTER_FRAME, onBeetlesLoop);

function onBeetlesLoop(evt:Event):void {
Beetles.x+=4;
if(Beetles.x>=1545) {
removeEventListener(Event.ENTER_FRAME, onBeetlesLoop);
}
}
}

function onClickSpray1(evt:MouseEvent):void {
drop2.visible = true;
spray1Child = true;
addChild(spray1);
addEventListener (Event.ENTER_FRAME, onLoopSpray1);
function onLoopSpray1(evt:Event):void {
spray1.x = mouseX;
spray1.y = mouseY + 50;
}
}

function onClickBeer(evt:MouseEvent):void {
drop3.visible = true;
beerChild = true;
addChild(beer);
addEventListener (Event.ENTER_FRAME, onLoopBeer);
function onLoopBeer(evt:Event):void {
beer.x = mouseX + 30;
beer.y = mouseY
}
}

function onClickLB(evt:MouseEvent):void {
drop4.visible = true;
bugChild = true;
addChild(lb);
addEventListener (Event.ENTER_FRAME, onLoopLB);
function onLoopLB(evt:Event):void {
lb.x = mouseX+30;
lb.y = mouseY
}
}

function onClickSpray2(evt:MouseEvent):void {
drop5.visible = true;
spray2Child = true;
addChild(spray2);
addEventListener (Event.ENTER_FRAME, onLoopSpray);
function onLoopSpray(evt:Event):void {
spray2.x = mouseX;
spray2.y = mouseY + 50;
}
}

function onClickCrowFly(evt:MouseEvent):void {
crow1.play();
crow2.play();
}

function onClickDrop1(evt:MouseEvent):void {
removeChild(cult);
drop1.visible = false;
}
function onClickDrop2(evt:MouseEvent):void {
removeChild(spray1);
drop2.visible = false;
}
function onClickDrop3(evt:MouseEvent):void {
removeChild(beer);
drop3.visible = false;
}
function onClickDrop4(evt:MouseEvent):void {
removeChild(lb);
bugChild = false;
drop4.visible = false;
}
function onClickDrop5(evt:MouseEvent):void {
removeChild(spray2);
drop5.visible = false;
}
function onClickDrop6(evt:MouseEvent):void {
removeChild(trap);
drop6.visible = false;
}

function onClickDrop7(evt:MouseEvent):void {
hose.visible = false;
drop7.visible = false;
}

function onSCDown(evt:MouseEvent):void {
scarecrow.play();
crow1.play();
crow2.play();
}

function onSCOut(evt:MouseEvent):void {
scarecrow.stop();
}

function onClickDog(evt:MouseEvent):void {
var dog:MovieClip = new Dog();
dog.x = 260;
dog.y = 140;
deerB.DeerC.gotoAndStop(1);
dog.play();
crow1.play();
crow2.play();
bunny.play();
if (groundhog.visible==true) {
groundhog.gotoAndPlay(1);
}
}

function onClickHose1(evt:MouseEvent):void {
hose.visible = true;
drop7.visible = true;
}

function onHoseDown(evt:MouseEvent):void {
hose.gotoAndPlay(“spray”);
}

function onHoseUp(evt:MouseEvent):void {
hose.gotoAndPlay(“right”);
}

function trapGH(evt:MouseEvent):void {
drop6.visible = true;
trapChild = true;
addChild(trap);
addEventListener (Event.ENTER_FRAME, onLoopTrap);
function onLoopTrap(evt:Event):void {
trap.x = mouseX + 100;
trap.y = mouseY
}
}

function relocateWin(evt:MouseEvent):void {
var relocate:MovieClip = new Relocate();
addChild(relocate);
relocate.x = 460;
relocate.y = 270;
removeChild(trap);
drop6.visible = false;
groundhog.visible = false
}

function onClickGH(evt:MouseEvent):void {
groundhog.visible=true;
groundhog.play();
}

function onClickBunny(evt:MouseEvent):void {
bunny.visible=true;
bunny.play();
}

function onClickDeer(evt:MouseEvent):void {
deerB.play();
deerB.DeerC.gotoAndPlay(1);
}

weed1.addEventListener(MouseEvent.CLICK, onClick);
weed2.addEventListener(MouseEvent.CLICK, onClick);
weed3.addEventListener(MouseEvent.CLICK, onClick);
weed4.addEventListener(MouseEvent.CLICK, onClick);

//SLUGS
slug1.addEventListener(MouseEvent.CLICK, onClick);
slug2.addEventListener(MouseEvent.CLICK, onClick);
slug3.addEventListener(MouseEvent.CLICK, onClick);
slug4.addEventListener(MouseEvent.CLICK, onClick);
slug5.addEventListener(MouseEvent.CLICK, onClick);
slug6.addEventListener(MouseEvent.CLICK, onClick);

//VEGIES
tomatoe1.addEventListener(MouseEvent.CLICK, onClick);
tomatoe2.addEventListener(MouseEvent.CLICK, onClick);
tomatoe3.addEventListener(MouseEvent.CLICK, onClick);
tomatoe4.addEventListener(MouseEvent.CLICK, onClick);
oregano1.addEventListener(MouseEvent.CLICK, onClick);
oregano2.addEventListener(MouseEvent.CLICK, onClick);
oregano3.addEventListener(MouseEvent.CLICK, onClick);
oregano4.addEventListener(MouseEvent.CLICK, onClick);
oregano5.addEventListener(MouseEvent.CLICK, onClick);
oregano6.addEventListener(MouseEvent.CLICK, onClick);
carrot1.addEventListener(MouseEvent.CLICK, onClick);
carrot2.addEventListener(MouseEvent.CLICK, onClick);
carrot3.addEventListener(MouseEvent.CLICK, onClick);
carrot4.addEventListener(MouseEvent.CLICK, onClick);
onion1.addEventListener(MouseEvent.CLICK, onClick);
onion2.addEventListener(MouseEvent.CLICK, onClick);
scallion1.addEventListener(MouseEvent.CLICK, onClick);
scallion2.addEventListener(MouseEvent.CLICK, onClick);
peas1.addEventListener(MouseEvent.CLICK, onClick);
peas2.addEventListener(MouseEvent.CLICK, onClick);
basil1.addEventListener(MouseEvent.CLICK, onClick);
basil2.addEventListener(MouseEvent.CLICK, onClick);
lettuce1.addEventListener(MouseEvent.CLICK, onClick);
lettuce2.addEventListener(MouseEvent.CLICK, onClick);
lettuce3.addEventListener(MouseEvent.CLICK, onClick);
lettuce4.addEventListener(MouseEvent.CLICK, onClick);
strawberry1.addEventListener(MouseEvent.CLICK, onClick);
strawberry2.addEventListener(MouseEvent.CLICK, onClick);
strawberry3.addEventListener(MouseEvent.CLICK, onClick);
strawberry4.addEventListener(MouseEvent.CLICK, onClick);
cabbage1.addEventListener(MouseEvent.CLICK, onClick);
cabbage2.addEventListener(MouseEvent.CLICK, onClick);
cabbage3.addEventListener(MouseEvent.CLICK, onClick);
cabbage4.addEventListener(MouseEvent.CLICK, onClick);
cabbage5.addEventListener(MouseEvent.CLICK, onClick);
cabbage6.addEventListener(MouseEvent.CLICK, onClick);

function onClick(evt:Event):void {
inst_mc.visible = false;
evt.currentTarget.play();
if(bugChild == true) {
evt.currentTarget.gotoAndStop(“ladyBugs”);
}
}