Groups | Blog | Home
all groups > flash actionscript > december 2006 >

flash actionscript : Easy Function


Erick Souza
12/28/2006 8:10:24 PM
Hi,
This way won't have effect.. I made two modifications, try this...

[quoted text, click to view]


--
Regards,
Erick Souza
12/28/2006 8:15:44 PM
I sent this line with a mistake, remove it ": String"

[...]
var my_win = mx.managers.PopUpManager.createPopUp(_root,
mx.containers.Window, true, {title:"test picture 1",
closeButton:true,contentPath:value:String});
[...]


--
Regards,
Erick Souza
12/28/2006 8:38:43 PM
LuigiL, I believe that the correct as follows.


function changePic(path:String):String{
return path;
}


--
Regards,
Obster
12/28/2006 9:25:39 PM
I know this should be an easy one but ive been busting my butt looking for a
solution.
I am trying to pull an external jpg file into a new window using different
buttons. I know there is a way to assign a function to each button for just the
file path then I dont have to copy and paste all the code to open up the window.
I created the function changepic() you can see where i want to insert the path
in "test picture 1". "test picture 2" shows the path without calling the
function. I have the button code at the bottom. Any assistance would be greatly
appreciated.
Thanks for your time. I know im doing something stupid.

import mx.managers.PopUpManager;
import mx.containers.Window;
function changePic() {

}

var issueLocation:Boolean = true;
function toggleCity() {
var currentArea:Number;
if (issueLocation) {
currentArea = 0;
issueLocation = false;
var my_win = mx.managers.PopUpManager.createPopUp(_root,
mx.containers.Window, true, {title:"test picture 1",
closeButton:true,contentPath:changePic()});
my_win.setSize (800,600);
var winListener:Object = new Object();
winListener.click = function() {
my_win.deletePopUp();
};
my_win.addEventListener("click", winListener);

} else {
currentArea = 1;
issueLocation = true;
var my_win = mx.managers.PopUpManager.createPopUp(_root,
mx.containers.Window, true, {title:"test picture 2",
closeButton:true,contentPath:"pics/test.jpg"});
my_win.setSize (800,600);
var winListener:Object = new Object();
winListener.click = function() {
my_win.deletePopUp();
};
my_win.addEventListener("click", winListener);



// location for future code to calculate Payoff from mySQL
}

}

button_btn.onPress = function() {
toggleCity();
changePic("pics/test.jpg");

}
LuigiL
12/28/2006 10:20:50 PM
Try the following, attached code.



var image:String;

function changePic(path:String):Void {
image=path;
}

//and change the event handler to
button_btn.onRelease = function() {
changePic("pics/test.jpg");
toggleCity();
}
Erick Souza
12/29/2006 9:00:24 AM
I understand. You didn't indicate the alteration in the toggleCity
function and I confused his objective.


--
Regards,
LuigiL
12/29/2006 10:31:14 AM
No. The script uses a simple timeline var 'image' which is set by changePic().
AddThis Social Bookmark Button