Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re. QuickTime Movie View



I tried the code below with a single window named "theWindow" and a movie view named "movieView" and the awake from nib handler connected to the window.


property
theWindow : null
property movieView : null
property scaleFactor : 1

on awake from nib theObject
set theWindow to theObject
set movieView to movie view "movieView" of theWindow
try
set theMovie to load movie (POSIX path of (choose file))
set movie of movieView to theMovie
copy (call method "sizeForMagnification:" of movieView with parameter 1) to {movieWidth, movieHeight}
set size of theWindow to {movieWidth * scaleFactor, movieHeight * scaleFactor + 16}
on error
log "f*** - this was the wrong file type. Restart the app to have a new trial!"
end try
end awake from nib



I do see some adjustments to the window sometimes but it never fits.
I am sorry to say that with some movies, the program aborts with:
movieTest has exited due to signal 11 (SIGSEGV).

What is wrong?

Regards,

John






--------------------------------------------------------------------------------------------

Hi,

so try another version

in IB give the main window a handler "awake from nib", put a movie view into and set up the right scaling handling for the movie view (and name it the right way - I named it 'movieView')

property theWindow : null
property movieView : null
property scaleFactor : 1
-- all properties are set in case you want to use them later on

on awake from nib theObject
set theWindow to theObject
set movieView to movie view "movieView" of theWindow


try
-- or use open panel to define what kind of file you want to open, or put this stuff attached to a button or whatever
set theMovie to load movie (choose file)
set movie of movieView to theMovie
copy (call method "sizeForMagnification:" of movieView with parameter 1) to {movieWidth, movieHeight}
set size of theWindow to {movieWidth * scaleFactor, movieHeight * scaleFactor + 16}
on error
log "f*** - this was the wrong file type. Restart the app to have a new trial!"
end try
end awake from nib

I haven't had a look for the extra +16, so you must have a look a the docs - or just try.

Regards
Andreas






 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.