You need to build the interactivity by adding "float" or "text" parameters to the Resolume class, then assigning listeners to those parameters. Once that's done, the Resolume environment will spawn a text field that will emable you to add a different account name to send the request to.
Here's how to set up the Flash parameters that Resolume can see:
//import the Resolume communication classes
import resolumeCom.*;
import resolumeCom.parameters.*;
import resolumeCom.events.*;
private var rtxt:StringParameter = resolume.addStringParameter("@Name", "EMAQDesign");
private var fontSizeSlider:FloatParameter = resolume.addFloatParameter("Font Size", 0.25);
private var fontStyleSlider:FloatParameter = resolume.addFloatParameter("Font Style" , 0.75);
private var fontSpacingSlider:FloatParameter = resolume.addFloatParameter("Tracking" , 0.25);
private var fontLeadingSlider:FloatParameter = resolume.addFloatParameter("Leading" , 0.25);
Notice how I have a bunch of resolume Float parameters and one resolume String parameter. Do they look familiar? These are the parameters that are the values for "format1" as defined previously. Now I can adjust the tracking/leading and font style on the fly-- if some of the twits are really short or really long, I want to adjust the text boxes to fit.
This next block of code listens for changes to our Resolume vars-- when it detects a change, it either reloads the XML (but we only want to do that when you change the @name parameter, since that parameter tells our XML call which Twitter account to request) or updates the font style. You'll notice it re-assigns the formatting variables, then makes another call to update text-- this re-applies the formatting AND re-populates the text boxes with data from the XML file, just in case there's been a change or a new tweet.
public function parameterChanged(event:ChangeEvent): void{
if (event.object == this.rtxt){
_user1 = this.rtxt.getValue();
loadXML();
} else if(event.object == fontStyleSlider){
theFontStyle = fontArray[Math.round(this.fontStyleSlider.getValue() * 10)];
initFormatting();
updateText(null);
} else if(event.object == fontLeadingSlider){
theFontLeading = Math.round(this.fontLeadingSlider.getValue() * 100);
fontSizeDisplay.text = String(theFontLeading);
initFormatting();
updateText(null);
} else if(event.object == this.fontSpacingSlider){
theLetterSpacing = Math.round(this.fontSpacingSlider.getValue() * 50);
initFormatting();
}else if(event.object == this.fontSizeSlider) {
theFontSize = Math.round(this.fontSizeSlider.getValue() * 100);
initFormatting();
updateText(null); // fontSizeDisplay.text = String(Math.round(this.fontSizeSlider.getValue() * 100));
}
}
And here's the "update text" function. Notice how I empty the text fields before putting more text in.
private function updateText(e:Event):void{
//// find all the text fields
for(var i:Number = 0; i < numTextBoxes; i++){
var theTextMC = mctxt.getChildByName("mctxtsub" + i);
var theTextBox = theTextMC.getChildByName("theBodyText");
//// clear all the text fields
theTextBox.text = "";
theTextBox.text = theTweetIndex[theNodeCounter];
theTextBox.setTextFormat(format1);
theTextBox.x = 0-theTextBox.width/2;
theTextBox.y = 0-theTextBox.height/2;
}
if(theNodeCounter > 3){
theNodeCounter = 0;
} else { theNodeCounter ++;
}
trace(theNodeCounter);
}
There you go! There's a log more finicky tweaking (don't get me started on the headaches of embedding fonts), but this is basically the gist of it. The most difficult part is parsing out the XML in a way that will look nice when we get it into Resolume.
In terms of performance, this runs pretty smoothly, altho I've noticed that Rez kinda takes a shit, processing-wise, when there's more than 3 layers of flash executing code. |