header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Flex_Flash
Points:200
Posts:2

3/7/2010 9:07:29 AM

Title: How to use vb script in Flex ?


Can we call or insert the VB script using flex?

If possible, could you plz give me one example

Thanks advance



Alex
Points: 0
Posts:0
3/7/2010 9:35:46 AM



you can use externalInterface class to expose functions from flex. see code below for flex . The exposed function is accessible from vbscript or javascript in html page.

<mx:Script>
    import flash.external.*;
    public function myExposedFunc():String {
        return "I am accessible from flex";
    }
    public function initApp():void {
        ExternalInterface.addCallback("myFlexFunction",myExposedFunc);
    }
</mx:Script>

I dont know how to write vbscript but flex function can be accessed the same way as we do from javascript . Javascript code is below

<SCRIPT language='JavaScript' charset='utf-8'>
    function callFlexApp() {
        var myText = MyFlexApplication.myFlexFunction();
        alert(myText);
    }
</SCRIPT>

Inder
Points: 2480
Posts:0
3/7/2010 11:27:23 AM



Hey FlexFlash,

To call a vbscript function from flex use this vbscript code in html body tag

<script language="vbscript" type="text/vbscript" >
Function vbFunction()
  MsgBox "function called from flash"
End Function
</script>

Now you can call "vbFunction()" from flex using "ExternalInterface.call("vbFunction");"
below is sample code for flex mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="1024" minHeight="768" applicationComplete="callExtFun()">
	<mx:Script>
		<![CDATA[
			
			private function callExtFun():void{
			ExternalInterface.call("vbFunction");
			}
		]]>
	</mx:Script>
</mx:Application> 


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 0+0 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions