-
Visual Basic and as3
Hi,
Im trying to find away of getting flash to play happy with vb6.
This was easy enough when using as2. But when using as2, for a vb developer to change a variable in flash they would use somthing like _root.vartochange = "blar blar".
However in as3 there is no such thing as "_root". Ive research this alot and caunt find anyway for vb to comunicate with flash. Would turning the flash into an air app make things any easier does any one know? This is a standalone flash app Im developing and not for web.
Has anyone a solution to this?
Or is there some sort of bridge I could use between the two?
Thanks
Aidan
-
Lifetime Friend of Site Staff
You're going to have to use ExternalInterface to communicate with AS3, just like you do in an HTML page with JavaScript. In this case your VB application is the host instead of the browse+javascript environment.
-
VB6 variables --> AS3
Originally Posted by Northcode
You're going to have to use ExternalInterface to communicate with AS3, just like you do in an HTML page with JavaScript. In this case your VB application is the host instead of the browse+javascript environment.
Can you explain this further?
basically i have SUCCESFULLY used fscommand to send variables from AS3 to VB6, but there doenst seem to be any way to do the opposite (send variables back from VB6 to AS3).
looking around on the web, EsternalInterface seems to be the only way that may provide a solution to do this, but i am new to as3 and don't have a clue how to write this function.
does anyone else know how to do this? i can be more specific, or upload the code i have if i need to!
PLEASE HELP!
-
Hi matt sorry for the late reply,
If I was to use exsternalInterface I was going to use this blog post as refference. Seemed to make sense...
http://nitin-sinha.blogspot.com/2009...unication.html
However I'm a flash developer and have no idea about vb.
Our resident VB developer struggled to get the cradle that holds the flash set-up correctly in vb.
As a consequence we didn't use exsternalInterface.
In the end we used a xml socket which can be notoriously difficult to set-up as quit often you need some kind of demon for it to work.
However because this was working on a locale machine.. i don't think out vb developer needed to create a demon.
As such a xml socket between flash and our vb back end works sweet as a nut!
If you fancy having a crack at the xml socket have a butches at this....
http://livedocs.adobe.com/flash/9.0/...XMLSocket.html
-
aidanmack,
your right, i just figured out how to use xml sockets they work great. i've heard they might have the potential to be slow or be interuppted by firewalls, but so far no problems, its working great.
i have a quesiton about flash. in my project, i have a slider that moves up and down on a rectangle:
var bounds:Rectangle = new Rectangle(424.9, 37, 0, 320);//gives a line, slider can only
//slide on this line
i have been using xml sockets to track the position of the slider and send to VB. the rectangle has 320 positions, divided by 40 makes 8 (it turns on a series of eight lights).
anyway, i have been tracking the position by using this code:
function sData(e:ProgressEvent):void{
var d:String=s.readUTFBytes(s.bytesAvailable);
d=d.charAt(0);
trace(d);
slider.y=Number(d);
}
specifacally the part that says, slider.y=Number(d);
the problem with this is that it's tracking the slider's position on the stage (y).
Is there a way to track the slider's position on the Rectangle? that way it would be more accurate.
for example: slider.RECTANGLE=Number(d) rather than slider.y=Number(d);
do you get what i mean or do i need to re-explain that lol
thanks
Last edited by mattwatts15; 10-08-2009 at 07:14 AM.
Reason: to clarify
-
Lifetime Friend of Site Staff
mattwatts15: Subtract the sliders y location on the stage from the current y location of the slider to get a value from 0..max_slider_position and map that onto the range from 0..320 (or whatever the maximum height of your rectangle is).
aidanmack: If your VB guy wants a working VB project that implements ExternalInterface in both directions just give me a shout by PM or email to support@northcode.com and I'll hook you up.
-
mattwatts15: Ummm yeah I would go with what he said (northcode) ha
Northcode Thanks sir, Will make a note of your username/post. I think things are going to get rather complicated in the next few weeks for myself and vb developers. If we get stuck will let you know.
We pay via paypal!
Tar
Aidan
-
Lifetime Friend of Site Staff
aidanmack I haven't posted it here because it was something I just whipped up and it's kinda drity but I'm not looking for $, you can have the VB sample for nothing if you want it.
-
Cheers Tim,
By all means send it through! Might come in handy at some point.
aidanmack at hotmail dot com
Thanks again.
-
Lifetime Friend of Site Staff
Sent
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|