I'm creating silverlight without visual studio. I just have raw html, xaml, and js (javascript).
What I want to do is pass values from the xaml to the javascript. I can call and activate javascript functions from xaml. See below. The canvas element has a mouse left button up event that callls LandOnSpace in the javascript.
But how would I call ShowMsg? Or more accurately, how would I pass values to that call? Normally in javascript you can just go: ShowMsg(500, 700, "you owe us money");
But when I try that in the xaml code, it breaks something. I believe it complains that the javascript function doesn't exist.
<Canvas x:Name="btnLandOnSpace" Background="LightGreen" MouseLeftButtonUp="LandOnSpace"
Cursor="Hand" Canvas.Top ="0" Width="70" Height="50">
<TextBlock Text="LandOnSpace" />
</Canvas>
function LandOnSpace(sender, e) { //on server
if (!ShipAnimateActive && !blnWaitingOnServer) {
blnWaitingOnServer = true;
RunServerFunction("/sqgame/getJSLLandOnSpace");
ShowWaitingBox();
};
else {
alert('Waiting on server.');
};
}
function ShowMsg(SintCost, SintRent , SstrChoiceText) {
blnPayChoice = true;
intCost = SintCost;
intRent = SintRent;
strChoiceText = SstrChoiceText; }