Strings and replacing their value
Hi All,
First of all, I apologize if my subject line is misleading I wasn't sure how to write it out.
Basically I'm wondering how can I use a sring to replace one uploaded image with a preloaded one? We have a custom card builder that allows the end user the choice of uploading their own image, or using one of our preloaded card faces. If the end user selects the preloaded version, we must then send a "hi res" version to the printer.
That hi res version is a completely different image file that I would call, replace the low res version and send to the printer. Here is the ActionScript (3) we are using ...
<code>
function getPatterns():void {
step2b.tlPattern.addItem({label:"", source:"clipart/_pat_10_thumb.png"});
step2b.tlPattern.addItem({label:"", source:"clipart/_pat_11_thumb.png"});
step2b.tlPattern.addItem({label:"", source:"clipart/_pat_12_thumb.png"});
step2b.tlPattern.addItem({label:"", source:"clipart/_pat_13_thumb.png"});
step2b.tlPattern.addItem({label:"", source:"clipart/_pat_14_thumb.png"});
step2b.tlPattern.addItem({label:"", source:"clipart/_pat_15_thumb.png"});
step2b.tlPattern.addItem({label:"", source:"clipart/_pat_16_thumb.png"});
step2b.tlPattern.addItem({label:"", source:"clipart/_pat_17_thumb.png"});
step2b.tlPattern.addItem({label:"", source:"clipart/_pat_18_thumb.png"});
step2b.tlPattern.addItem({label:"", source:"clipart/_pat_19_thumb.png"});
step2b.tlPattern.addItem({label:"", source:"clipart/_pat_20_thumb.png"});
step2b.tlPattern.addItem({label:"", source:"clipart/_pat_21_thumb.png"});
}
//===== Apply the currently selected pattern background
function clearBackground():void {
clearUpload();
clearPattern();
}
function clearUpload():void {
// Remove any uploaded image.
while (gcPreview.mcUpload.numChildren > 0) {
gcPreview.mcUpload.removeChildAt(0);
}
gcPreview.mcUpload.rotation = 0;
gcPreview.mcUpload.scaleX = 1;
gcPreview.mcUpload.scaleY = 1;
gcPreview.mcUpload.x = 0;
gcPreview.mcUpload.y = 0;
}
function clearPattern():void {
// Remove the old image
while (gcPreview.mcPattern.numChildren > 0) {
gcPreview.mcPattern.removeChildAt(0);
}
}
// CARD BUILDER CARD FACE INTERFACE CONTROL - below
function setPattern(e:Event):void {
// Change the background pattern from the gallery.
if (step2b.tlPattern.selectedItem) {
var ldr:Loader = new Loader(); //Declare the loader
ldr.load(new URLRequest(step2b.tlPattern.selectedItem.source.substring(0, step2b.tlPattern.selectedItem.source.length - 10)+".png")); //Load the template image
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
function onComplete(e:Event):void {
clearBackground();
gcPreview.mcPattern.addChild(ldr); // Apply it to the stage.
showStep("3"); // Go to the last step.
ldr.removeEventListener(Event.COMPLETE, onComplete);
}
} else {
// Remove the old image
clearPattern();
}
}
</code>
We would need the new card face "clipart/_pat_10_print.png" Called up. IF I haven;t supplied enough of the code pleaselet me know and we can work that out from there.
Thank you all, and I'm hoping you're having a great holiday season!!!
