Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-29-2003, 02:34 PM
Junior Member
 
Join Date: May 2003
Posts: 3
Default Image Viewer

Can SWFkit be used to load and view other graphic than jpeg, such as BMP, TIF and WMF-files
Reply With Quote
  #2 (permalink)  
Old 06-01-2003, 10:26 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: Image Viewer

Hi,

You can use an ActiveX object to convert the other graphic than jpg to jpg.

Here is one,
http://www.sourceforge.net/projects/freeimage

The new version of SWFKit that will come out in several days supports image conversion as well. But it's not as powful as the FreeImage object, it can only convert other graphic to jpg and doesn't support so many graphic formats.
Reply With Quote
  #3 (permalink)  
Old 06-01-2003, 10:30 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: Image Viewer

It's very easy to invoke an ActiveX object in SWFKit.

Firstly, you should register the ActiveX object before you can use it,

Code:
ActiveXObject.register('myObj.dll')
Eg.

In the initialize script
Code:
var fr = new ActiveXObject("frObj.frReportObj");
if (fr == undefined || fr.version == undefined || fr.version < 1.1)
{
   var fr_file = getAdditionalFile('frObj.dll');
   var f = new File(fr_file);
   var sys_path = Shell.getSpecialFolder("system") + '\\' + f.name;
   f.copy(sys_path);
   ActiveXObject.register(sys_path);
   
   fr = new ActiveXObject("frObj.frReportObj");
}
Reply With Quote
  #4 (permalink)  
Old 06-01-2003, 10:38 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: Image Viewer

Secondly, construct a new instance of the object.

For an Automation object,
Code:
var obj = new ActiveXObject('obj.myobj');
For an ActiveX control,
Code:
var control = createControl('obj.myObj', 0, 0, 200, 200);
var obj = control.activex;
Reply With Quote
  #5 (permalink)  
Old 06-01-2003, 10:40 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: Image Viewer

Then you can access the properties and methods of the object.

Code:
var value = obj.prop;
Code:
var result = obj.method1(arg0, arg1);
Reply With Quote
  #6 (permalink)  
Old 06-01-2003, 10:54 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: Image Viewer

You can also handle the events of the ActiveX Object
Code:
obj.onMyEvent = function (arg0, arg1, ..., argn)
{
  //do something
}
Some ActiveX objects need you to chang the values of the arguments of the event handler.

Eg. The Microsoft WebBrowser object has an event,
BeforeNavigate2(obj, url, flags, TargetFrameName, PostData, Headers, Cancel)

'Occurs when the WebBrowser control is about to navigate to a different URL, which may happen as a result of external automation, internal automation from a script, or the user clicking a link or typing in the address bar. The container has an opportunity to cancel the pending navigation. '

The last argument 'Cancel' is a boolean value, you can set it to TRUE to cancel the navigation operation, or to FALSE to allow it to proceed.

But FFish script cannot transfer data back to the object by set the value of the argument directly. To make it work, SWFKit converts the argument to an object value automatically.
Reply With Quote
  #7 (permalink)  
Old 06-01-2003, 10:57 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: Image Viewer

The converted object has a property 'value', contains the real value of the argument, you can set the value of the argument by change the property,

Code:
webb.BeforeNavigate2 = function (obj, url, flags, TargetFrameName, PostData, Headers, Cancel) 
{
  trace('go to the url ' + url);
  //cancel the operation
  Cancel.value = true;
}
Reply With Quote
  #8 (permalink)  
Old 06-01-2003, 11:02 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re: Image Viewer

SWFKit converts the data types automatically for you. *


ActiveX Object
FFish Script


int, byte, float, double * * * * * * * * * * * * * *
number


string
string


date
number, you can use 'new Date(num)' to get the datetime


binary data
StringStream


IDispatch
ActiveXObject object

Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:37 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.