Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 5th, 2007, 11:41 AM
Registered User
 
Join Date: Jun 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Adding values in a flash game.

Say i wanted to change a value (score) to 99999 all i would have to do is this.
Call (the flashs name).setvariable("score", 99999)
But if i wanted to add 99999 to my score i don't know how becuase even doing all this doesnt help
Dim int1 As Integer
int1 = Text6.Text
Call SWF.SetVariable("score" + int1)
End Sub
And ive tried soo many different ways, if someone could help i would be very happy.

 
Old June 5th, 2007, 11:48 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default

If you dim what is in the variable score as something then dim the value you want to add to it then add them together using vb then send the variable to the flash game

Dim int1 As Integer
Dim int2 As Integer
Dim int3 As Integer

int1 = swf.variable("score") 'dont know wot you would use to call the variable

int2 = text6.text
int3 = int2 + int1
Call SWF.SetVariable(int3)

Something like tht would be used, im guessing anyway.

Apocolypse


------------------------------------------------
Apocolypse2005
Always ready and waiting to be helped!
 
Old June 5th, 2007, 11:52 AM
Registered User
 
Join Date: Jun 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Using this
Private Sub Check6_Click()
Dim int1 As Integer
Dim int2 As Integer
Dim int3 As Integer
int1 = Text6.Text
int2 = SWF.GetVariable("money")
int3 = int1 + int2
Call SWF.SetVariable(int3)
End Sub
It gives me a argument not optional for the Call SWF.setvariable(int3)
but i think i could fix it by changing it to Call SWF.setvariable("money", int3)
edit: ok well the little fix i added worked, now how would i store values for later use?
edit2: also i get overflow if i add the values to much o.o
 
Old June 5th, 2007, 11:59 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default

wot i would do is have a label and output the value of int1 + int2 just to see if you get an integer and if the getvariable method has worked! When you type in the brackets for SetVariable method does it come up with a tool tip text (yellow box (or white)) telling wot to enter?

Apocolypse


------------------------------------------------
Apocolypse2005
Always ready and waiting to be helped!
 
Old June 5th, 2007, 12:00 PM
Registered User
 
Join Date: Jun 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My method works, with my trainer for my flash game it adds the value, but it will give me a overflow error if i spam click it about 50 times >.>.

 
Old June 5th, 2007, 12:06 PM
Registered User
 
Join Date: Jun 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This method also works (and makes more sense to me)
Private Sub Check6_Click()
Dim int1 As Integer
Dim int2 As Integer
Dim int3 As Integer
int1 = Text6.Text
int2 = SWF.GetVariable("money")
Call SWF.SetVariable("money", Val(int1 + int2))
End Sub


 
Old June 5th, 2007, 12:15 PM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default

Cool, okay then! How did you create SWF object is it a variable or what?
 
Old June 5th, 2007, 05:03 PM
Registered User
 
Join Date: Jun 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How would you go around looping somethign like.
Dim int1 As Integer
int1 = SWF.GetVariable("maxmp")
Call SWF.SetVariable("mp", Val(int1))

Only i want it to be looping such as
if SWF.Getvariable("mp" > "maxmp) then
Dim int1 As Integer
int1 = SWF.GetVariable("maxmp")
Call SWF.SetVariable("mp", Val(int1))






Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a flash animation nuth BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 November 23rd, 2007 05:55 AM
Pass values from Aspx page to Flash Muthunagai.A ASP.NET 1.0 and 1.1 Professional 0 April 25th, 2007 11:43 PM
Pass values from Aspx page to Flash Muthunagai.A ASP.NET 1.0 and 1.1 Basics 0 April 25th, 2007 11:41 PM
Pass values from Aspx page to Flash Muthunagai.A Excel VBA 0 April 25th, 2007 11:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.