|
|||
|
Im trying to make my work a bit easier in fututre by binding ie control with one of my MC's
but it isnt working Heres my code... tell me what am i doing wrong i desperatly need help!!! Code:
import SWFKit.*;
import SWFKit.FlashPlayer.*;
import WebBrowser;
function forumSpy():Void {
var Locate = LocateMC;
var LocateX = getProperty(LocateMC, _x);
var LocateY = getProperty(LocateMC, _y);
var locateW = getProperty(LocateMC, _width);
var locateH = getProperty(LocateMC, _height);
//Create the web browser control
var ax = Global.createControl("Shell.Explorer.2", 0,0,0,0);
// Fill the web browser control in the entire client area of the
// main window
var win = Global.getMainWnd();
ax.window.move(LocateX, LocateY, locateW, locateH);
function onSize(type, width, height)
{
ax.window.move(LocateX, LocateY, LocateW, LocateH);
}
win.setEventHandler("onSize", onSize);
var wb = WebBrowser.fromID(ax.activex);
// handle event of the ActiveX control
function NavigateComplete2(control, url)
{
_root.strace(url);
}
wb.setEventHandler("NavigateComplete2", NavigateComplete2);
// Browse web site
wb.Navigate2("http://mysite.com");
}
forumSpy();
I also tryied hide and close function... but bothing. in 8 hours now, what i have been testing, is not working... Code:
import SWFKit.*;
import SWFKit.FlashPlayer.*;
import WebBrowser;
function yess(){
// Create the web browser control
var ax = Global.createControl("Shell.Explorer.2", 0, 0, 200, 200);
// Fill the web browser control in the entire client area of the
// main window
var win = Global.getMainWnd();
ax.win.move(1, 23, 500, 216);
function onSize(type, width, height)
{
ax.win.move(1, 23, 500, 216);
}
win.setEventHandler("onSize", onSize);
var wb = WebBrowser.fromID(ax.activex);
// handle event of the ActiveX control
function NavigateComplete2(control, url)
{
_root.strace(url);
}
wb.setEventHandler("NavigateComplete2", NavigateComplete2);
// Browse web site
wb.Navigate2("http://www.flashguru.se/forum/forumspy.php");
}
function hiDe() {
ax.win.hide();
}
testt.addEventListener("click", hiDe);
yess();
|
|
|||
|
i do not have this conde anymore :S i had to change ans use permanent x / y and w/h positions.
but at the moment ive been struggling with another problem (started even new topic) since Createcontrol uses IE, then all the links are opened in IE (that have "_blank"), what do i need to do in as2 to make the links open new firefox window ??? i have no access to the website that im publishing with createcontrol() so i need a solution in as2 Thanx for your efforts and time! |
|
|||
|
You may use the method mentioned in another topic: first find the path name of firefox exe, and then launch it to open your html files. However, there is a disadvantage: the end users may have not installed firefox.
And it is unnecessary to do everything in as. In fact, calling ffish script from actionscript may be more convenient, and usually, can get higher performance. Any synchronous call between as and fs costs much CPU time, as a call should first be converted to XML data that will be parsed on the other side. Moreover, the "initialize" script is very useful and you cannot find equivalent action script. |
|
|||
|
yes, i found the code you postet there getFirefixPath()
but i cant get it to work, i think i need swfkit to get a link adress and then use firefox to open that link. ive tryied to use getVariable and so on, so i could get this link adress but i couldnt. |
|
|||
|
heres the code i try to get to work
Code:
import SWFKit.*;
import SWFKit.FlashPlayer.*;
import WebBrowser;
// Create the web browser control
var ax = Global.createControl("Shell.Explorer.2", 0, 0, 200, 200);
// Fill the web browser control in the entire client area of the
// main window
var win = Global.getMainWnd();
function klick() {
Global.trace("ax");
}
ax.setEventHandler("onClick", klick);
ax.window.move(1, 23, 500, 216);
function onSize(type, width, height)
{
ax.win.move(1, 23, 500, 216);
}
win.setEventHandler("onSize", onSize);
var wb = WebBrowser.fromID(ax.activex);
// handle event of the ActiveX control
function NavigateComplete2(control, url)
{
_root.strace(url);
}
wb.setEventHandler("NavigateComplete2", NavigateComplete2);
wb.addEventListener("click", hamtaSidan);
// Browse web site
wb.Navigate2("http://site.com");
function onClick() {
Global.trace("HIDE");
ax.window.hide();
_root.holder.Meny._visible = true;
hide_WB._visible = false;
info_WB._visible = false;
ut_WB._visible = false;
}
hide_WB._visible = true;
_root.holder.Meny._visible = false;
hide_WB.addEventListener("click", onClick);
//yess();
function getFireFoxExePath() {
var keyName = "HKLM\\SOFTWARE\\Mozilla\\Mozilla Firefox";
var key = new RegKey(keyName);
if (key != null) {
var ver = key.getValue("CurrentVersion").data;
keyName = keyName + "\\" + ver + "\\Main";
key = new RegKey(keyName);
if (key != null) {
var pathName = key.getValue("PathToExe").data;
return pathName;
}
}
// this is for older versions of Firefox (eg, 0.8).
else {
keyName = "SOFTWARE\mozilla.org\Mozilla Firefox";
key = new RegKey(keyName);
if (key != null) {
var ver = key.getValue("CurrentVersion").data;
keyName = keyName + "\\" + ver + "\\Main";
key = new RegKey(keyName);
if (key != null) {
var pathName = key.getValue("PathToExe").data;
return pathName;
}
}
}
}
function hamtaSidan() {
//Shell.run(getFireFoxExePath());
Global.trace(getFireFoxExePath()+ getValue());
}
|
|
|||
|
|
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|