Member Avatar for Member #114696
Member #114696

well i saw a problem with many while using same swf file and use it as a link in webpage. It wold show the quality of showing the required title and go to the webpage.

Make a box i.e. your button and a dynamic text field with var value linkName.

Convert that box into a symbol('option: movie clip') and write this code

on (release)
 {
     getURL(_root.linkValue.split("^").join("&"), "");
 }

thats over now whenever you make a link using flash button use this code in html file

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="157" height="26">
<param name="movie" value="../../Swf/BTN157x26BLANK.swf?linkName=View Website&linkValue=http://www.livingchildren.com/">
 <param name="quality" value="high">
<param name="wmode" value="transparent">
<embed src="new.swf?linkName=Google&linkValue=http://www.google.com/" quality=high 
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="157" height="26"></embed>
</object>

note:
<embed src="new.swf?linkName=Google&linkValue=http://www.google.com/"
you give few parameters to that swf link

vishesh

Dani AI

Generated

Good idea, @vishesh — reusing one SWF for many links keeps assets small and maintainable. Two important notes up front: Flash Player reached end-of-life on December 31, 2020 (modern browsers block or no longer support SWFs), so migrate to HTML5 if possible. If maintaining SWFs is necessary, prefer passing per-instance data into the movie (FlashVars) and let the SWF behave differently based on those values. (adobe.com)

Prefer FlashVars (or a small embedding library such as SWFObject) instead of stuffing a query string into the SWF filename. FlashVars are name=value pairs pushed into the movie on load; they should be URL-encoded on the page and, in XHTML, ampersands must be escaped as &amp;. Libraries like SWFObject simplify per-instance params and IDs when you embed multiple SWFs on one page. (flylib.com)

Example patterns (don’t copy the old query-string technique — use FlashVars and read them in the movie):

HTML (object/embed with FlashVars)

<object width="157" height="26" data="button.swf" type="application/x-shockwave-flash">
  <param name="movie" value="button.swf" />
  <param name="flashvars" value="linkName=View+Site&linkValue=http%3A%2F%2Fexample.com" />
  <embed src="button.swf" flashvars="linkName=View+Site&linkValue=http%3A%2F%2Fexample.com" width="157" height="26"></embed>
</object>

ActionScript 3 — read params and open URL safely:

var params:Object = LoaderInfo(this.root.loaderInfo).parameters;
var dest:String = params.linkValue || "http://example.com";
try {
  navigateToURL(new URLRequest(decodeURIComponent(dest)), "_blank");
} catch (err:Error) {
  trace("Bad URL:", dest);
}

(AS3 reads FlashVars via loaderInfo.parameters and opens links with navigateToURL.) (community.adobe.com)

Quick troubleshooting & cautions: 1) Don’t pass secrets in FlashVars — they’re visible to users. 2) wmode=transparent/opaque can slow rendering and break keyboard/assistive behaviour — avoid unless you need transparency. 3) If you embed the same SWF multiple times, give each instance a unique ID and avoid relying on global _root state inside the movie. Test across browsers and use a JS embed helper (SWFObject) to get consistent FlashVars behavior. (permadi.com)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.