Hi Guys,
Tag Team back again! I feel like I’m on the right track here, but I’m lacking some operative vocabulary along with a fundamental understanding of how this might work.
Some background:
There’s a great Quality Measures Flash app here. I’m not trying to go all out and pull from an XML to load my content - I just want to accomplish something similar, though much simpler, using the items in my library.
Can you guys educate me on the following?
- Grouping Arrays:
How can I combine diverse items in an array (e.g., movie clips buttons; images; two different text strings) while maintaining the handy myDumbArray*.addEventListener(MOUSE_EVENT) stuff?
I know this should be a job for XML, but this .swf will publish to a database driven CMS.
- .currentTarget Usage:
Can I populate my loaders with diverse, parsed array material using .currentTarget? Because if I can’t, I reckon I’m already on Fail Road, Atlanta, GA, 30327.
Does this resemble the right direction? Should I be cold and frightened?
Code included below:
//import and initialize all stuff
import flash.display.*;
import flash.net.URLRequest;
import fl.controls.ProgressBar;
import flash.events.MouseEvent;
import caurina.transitions.*;
import caurina.transitions.properties.ColorShortcuts;
import caurina.transitions.properties.FilterShortcuts;
FilterShortcuts.init();
ColorShortcuts.init();
//setup loaders and progress bar
//graphLoader
var graphLoader:Loader = new Loader();
graphLoader.x = 40;
graphLoader.y = 110;
//graphPB
var graphPB:ProgressBar = new ProgressBar();
graphPB.source = graphLoader.contentLoaderInfo;
graphPB.x = 275;
graphPB.y = 160;
//graphLoadingFunction
graphLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishLoadingGraph);
function finishLoadingGraph(e:Event):void
{
addChild(graphLoader);
removeChild(graphPB);
//graphPB = null;
}
//qualityTextLoader
var qualityTxtLoader:Loader = new Loader();
qualityTxtLoader.x = 100;
qualityTxtLoader.y = 246;
//qualityTextLoadingFunction
qualityTxtLoader.addEventListener(Event.COMPLETE, finishLoadingQualityTxt);
function finishLoadingQualityTxt(e:Event):void
{
//addChild(qualityTxtLoader);
}
//set up arrays
//angioArray
var angio_measureTxt:String="Percentage of heart attack patients who receive angioplasty within 90 minutes of hospital arrival.";
var angio_whyTxt:String="Time is Muscle - Opening the vessel as soon as possible restores blood flow to the heart muscle. Quickly restoring blood flow reduces the damage to the heart during a heart attack. WellStar treats the most patients emergently for heart attack of any hospital in metro Atlanta.";
//buttonArray
var myBtnArray:Array = new Array(mc_Angio, mc_BetaBlocker, mc_Aspirin, mc_Ace, mc_Smoking);
//mouseEvent for loop
for (var i:Number = 0; i < myBtnArray.length; i++)
{
myBtnArray*.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
myBtnArray*.addEventListener(MouseEvent.MOUSE_OUT, outHandler);
myBtnArray*.addEventListener(MouseEvent.MOUSE_DOWN, getStuff);
}
//set up handlers
function overHandler(e:MouseEvent)
{
Tweener.addTween(e.currentTarget, {x:255, _color:0xea0437, transition:"linear", time:.25});
}
function outHandler (e:MouseEvent)
{
Tweener.addTween(e.currentTarget, {x:250, _color:0x00000, transition:"linear", time:.25});
}
function getStuff(e:MouseEvent):void
{
trace("Wut");
//qualityTxtLoader.load(new MovieClip ("angio_measureTxt"));
graphLoader.load(new URLRequest("P01.jpg"));
addChild(graphPB);
}