The main thing in this i have written a code for swf and also the html and i need to pass the 2 parameters from html to swf i am passing clicktag param and other parameter. i know how to access the clicktag param in action script but i am getting confused to use the another parameter passed with that. i am accessing clicktag as _root.clickTAG so i can easily access it but when i wanted to use another param in the same way nothing is happening . can you anyone please help me regarding this.
Thanks in Advance
You need to pass in two variables using FlashVars. At it's simplest you can just use
<PARAM NAME=FlashVars VALUE="clickTAG=http://www.domain.com&secondParam=12345">
(though it is worth looking at swfObject to embed the swf). Then in Flash (AS2) you can access the vars directly, eg
on (release) {
getURL(clickTAG + "&mySecondVarIs" + secondParam, "_blank");
}
inside a movie clip we have to address to root like _root.clickTAG otherwise it does not work.
Related
I've got the following javascript writing HTML for FlexPlayer:
document.writeln("<object width=\"489\" height=\"414\" FlashVars=\""+videoSource+"\">");
document.writeln("<param name=FlashVars value='sourceUrl=videoSource'>");
I need to have FlashVars="sourceUrl=videoSource"; where videoSource is a variable which I get from PHP for the current video and sourceUrl is variable form the Flex player. Please repair the int he first row cause this FlashVars syntax is driving me mad.
You should use SWFObject as an easier way to embed your swf into your website. It also has a very simple way to include parameters (flashvars) into your movie in the documentation.
I have an actionscript project, and I have provided the function that I want it to be called from HTML(the flash builder generated html file).
ExternalInterface.addCallback("getURL", getURL);
This is the code in actionscript, how can I modify the flash builder generated html file so that it can call getURL()?
Just add your function between <script> tags in index.template.html file that is located in html-template folder of your project.
alternatively, you don't have to use the html template, it's totally possible for you to create your own html and implement your own settings. Just go to the Project properties and uncheck the "Generate HTML..." checkbox.
as for your javascript function , you could have it in an external file and access it like this. it'd be easier to maintain, if the need to add more functions arises
<script type="text/javascript" src="external.js"></script>
Can you please give me some leads into passing variables from a HTML(or)ASP.NET file to Flash Action Script 3 file.
Please Help.
Thanks
Here is an in-depth tutorial by Adobe on this subject.
To summarize, you have two options:
Add FlashVars="myVariable=value" attribute to your <embed> tag which embeds your SWF
Add <param name=FlashVars value="myVariable=value"/> to your <object> tag which embeds your SWF
After this you can access your "key" variable from the document class or any display object attached to the stage using:
var myVariable:String = LoaderInfo(this.root.loaderInfo).parameters.myVariable.toString();
Good luck coding : j
I'm trying to get current browser url. I have already tried with External Call, and it didn't work. And with loaderInfo.url I receive the current SWF url.
Give this a go:
import flash.external.ExternalInterface;
var url:String = ExternalInterface.call("window.location.href.toString");
if (url) textfield.text = url;
should do the trick.
There are a couple of ways to solve this problem, however all of them involve the use of JavaScript to query the browser directly.
My preferred way to solve this problem would be to provide the URL via a flashVar property, direct from the embed code (personally, I would reccomend using SWFObject to make this easier); don't forget you will need to URL Encode it to avoid markup issues.
var flashvars = {
browserURL: escape(location.href)
};
swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0", "expressInstall.swf", flashvars);
Now you will be able to access the Browser URL via the loaderInfo object:
trace(stage.loaderInfo.parameters["browserURL"]);
note that this will only work if you have control of generated HTML for your SWF file - if users are going to be grabbing the SWF and writing their own embed HTML, it's not going to work.
If you don't have control of the flash embed HTML, then you will need to get flash to query the browser at runtime using the ExternalInterface class; other people have suggested the use of "window.location.href.toString" however this can prove problematic in IE6, I find the following works reliably across all browsers
const browserURL : String = ExternalInterface.call("eval", "window.location.href");
Note that in order for this to work, you will need to grant JavaScript access to your Flash movie, this is done, again, via the HTML embed code and the allowScriptAccess param
var url:String = loaderInfo.loaderURL;
seems to work too.
I would try passing the required info in as a flashvar. Not the best out of the box solution I know, but it will work.
Flash: FlashVars in AS3
i think its posible to use the external interface an do it with javascript window.location
I have been using flash for a long time and never noticed this one. It only gives the domain though for security. It does work through loaded swfs as well. Not sure about iframes.
Security.pageDomain
I have ActiveX control done in VC++/MFC. It embeds into html web page. Now I need to be able to configure it by providing parameters in html tag. like:
The question is how do I read those parameters during my ActiveX initialization? My research revealed that it has to be done through IPersistPropertyBag interface, but I could really use some code examples to figure that out.
Any examples in VC++ please?
Thanks,
Mike
I will answer my own question...
Basically from ActiveX point of view those HTML parameters are "persistent storage" parameters.
So in your HTML file:
<OBJECT ID="activex1" WIDTH=300 HEIGHT=200
...
<PARAM NAME="ServerAddress" VALUE="192.168.1.1:1234">
...
</OBJECT>
And in your MFC ActiveX control:
void Cubcam_activexCtrl::DoPropExchange(CPropExchange* pPX)
{
ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
COleControl::DoPropExchange(pPX);
// TODO: Call PX_ functions for each persistent custom property.
PX_String(pPX, _T("ServerAddress"), m_serverAddress, _T(""));
}
Interesting; I will have to try the method you describe. The way that I know of to do this is to implement the IPersistPropertyBag interface and implement the Load method.
I haven't used MFC, just ATL, but I implemented this by hand. I will have to look into the solution you provided to see if there are advantages to the underlying approach used by MFC.